Skip to content

Does the API server SchedulerService interact with the master without passing rpc?(API server SchedulerService 与master交互时候没有经过rpc?) #31

@lshmouse

Description

@lshmouse

Recently, when I saw the implementation of the SchedulerService, I had a question. SetScheduleState is used to set the schedule online.
Instead of calling the master's rpc, it is called directly: setSchedule. The setSchedule implementation is a directly modified QuartzExecutors

I feel that there is a problem in the distributed deployment of api and master. I don't know if I understand it correctly? Is there any revision plan afterwards?

    Public void setSchedule(int projectId, int scheduleId) throws RuntimeException{
        Logger.info("set schedule, project id: {}, scheduleId: {}", projectId, scheduleId);


        Schedule schedule = processDao.querySchedule(scheduleId);
        If (schedule == null) {
            Logger.warn("process schedule info not exists");
        }

        Date startDate = schedule.getStartTime();
        Date endDate = schedule.getEndTime();

        String jobName = QuartzExecutors.buildJobName(scheduleId);
        String jobGroupName = QuartzExecutors.buildJobGroupName(projectId);

        Map<String, Object> dataMap = QuartzExecutors.buildDataMap(projectId, scheduleId, schedule);

        QuartzExecutors.getInstance().addJob(ProcessScheduleJob.class, jobName, jobGroupName, startDate, endDate,
                schedule.getCrontab(), dataMap);

    }

最近看SchedulerService 实现时候有个疑问, setScheduleState 里面实现设置调度online时候
没有调用master的rpc,而是直接调用:setSchedule。setSchedule 实现是直接修改的QuartzExecutors

感觉在在api与master分布式部署时候有问题 不知道是否理解正确? 后续有修改计划吗

    public void setSchedule(int projectId, int scheduleId) throws RuntimeException{
        logger.info("set schedule, project id: {}, scheduleId: {}", projectId, scheduleId);


        Schedule schedule = processDao.querySchedule(scheduleId);
        if (schedule == null) {
            logger.warn("process schedule info not exists");
        }

        Date startDate = schedule.getStartTime();
        Date endDate = schedule.getEndTime();

        String jobName = QuartzExecutors.buildJobName(scheduleId);
        String jobGroupName = QuartzExecutors.buildJobGroupName(projectId);

        Map<String, Object> dataMap = QuartzExecutors.buildDataMap(projectId, scheduleId, schedule);

        QuartzExecutors.getInstance().addJob(ProcessScheduleJob.class, jobName, jobGroupName, startDate, endDate,
                schedule.getCrontab(), dataMap);

    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions