-
Notifications
You must be signed in to change notification settings - Fork 5k
Does the API server SchedulerService interact with the master without passing rpc?(API server SchedulerService 与master交互时候没有经过rpc?) #31
Copy link
Copy link
Closed
Description
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);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels