use of com.flink.platform.web.entity.JobFlowQuartzInfo in project flink-platform-backend by itinycheng.
the class JobFlowController method runOnce.
@GetMapping(value = "/schedule/runOnce/{flowId}")
public ResultInfo<Long> runOnce(@PathVariable Long flowId) {
JobFlow jobFlow = jobFlowService.getById(flowId);
JobFlowStatus status = jobFlow.getStatus();
if (status == null || !status.isRunnable()) {
return failure(NOT_RUNNABLE_STATUS);
}
// TODO better in sync lock.
JobFlowRun jobFlowRun = jobFlowRunService.getById(flowId);
if (jobFlowRun != null && !jobFlowRun.getStatus().isTerminalState()) {
return failure(SERVICE_ERROR);
}
JobFlowQuartzInfo jobFlowQuartzInfo = new JobFlowQuartzInfo(jobFlow);
if (quartzService.runOnce(jobFlowQuartzInfo)) {
return ResultInfo.success(flowId);
} else {
return failure(SERVICE_ERROR);
}
}
use of com.flink.platform.web.entity.JobFlowQuartzInfo in project flink-platform-backend by itinycheng.
the class JobFlowQuartzService method scheduleJob.
@Transactional(rollbackFor = Exception.class)
public boolean scheduleJob(JobFlow jobFlow) {
JobFlowQuartzInfo jobFlowQuartzInfo = new JobFlowQuartzInfo(jobFlow);
boolean bool = quartzService.addJobToQuartz(jobFlowQuartzInfo);
JobFlow newJobFlow = new JobFlow();
newJobFlow.setId(jobFlow.getId());
newJobFlow.setStatus(SCHEDULING);
jobFlowService.updateById(newJobFlow);
return bool;
}
use of com.flink.platform.web.entity.JobFlowQuartzInfo in project flink-platform-backend by itinycheng.
the class JobFlowQuartzService method stopJob.
@Transactional(rollbackFor = Exception.class)
public boolean stopJob(JobFlow jobFlow) {
JobFlowQuartzInfo jobFlowQuartzInfo = new JobFlowQuartzInfo(jobFlow);
quartzService.removeJob(jobFlowQuartzInfo);
JobFlow newJobFlow = new JobFlow();
newJobFlow.setId(jobFlow.getId());
newJobFlow.setStatus(ONLINE);
jobFlowService.updateById(newJobFlow);
return true;
}
Aggregations