Commit 7449393e by huangfusuper

取消日志文件重复添加BUG

parent 8388512b
...@@ -45,11 +45,6 @@ public class FlowThreadRunHelper extends BaseThreadRunHelper { ...@@ -45,11 +45,6 @@ public class FlowThreadRunHelper extends BaseThreadRunHelper {
if (CollectionUtil.isNotEmpty(halfAnHourFlow)) { if (CollectionUtil.isNotEmpty(halfAnHourFlow)) {
for(Flow flow : halfAnHourFlow ){ for(Flow flow : halfAnHourFlow ){
log.debug("-----------------【工作流{}的执行次数不等于0,放行】-------------------------",flow.getFlowName()); log.debug("-----------------【工作流{}的执行次数不等于0,放行】-------------------------",flow.getFlowName());
/*if (runRecordingService.findRunRecordingIsRunning(flow.getFlowId())) {
//TODO 是否可以使用事件通知机制,由完结的工作流实例通知通过流可以运行了
log.info("-----工作流{},有正在运行中的实例,跳过等待------",flow)
continue;
}*/
Integer flowId = flow.getFlowId(); Integer flowId = flow.getFlowId();
//根据工作流查询工作流下所有的节点 //根据工作流查询工作流下所有的节点
List<Node> nodeByFlowIdAndVersionName = nodeService.findNodeByFlowIdAndVersionName(flowId); List<Node> nodeByFlowIdAndVersionName = nodeService.findNodeByFlowIdAndVersionName(flowId);
......
...@@ -55,14 +55,7 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper { ...@@ -55,14 +55,7 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper {
mythJobTaskSchedule.setRunParam(PlaceholderUtils.formatParam(mythJobTaskSchedule.getRunParam())); mythJobTaskSchedule.setRunParam(PlaceholderUtils.formatParam(mythJobTaskSchedule.getRunParam()));
} }
//如果是重跑就有logId
Integer logId = mythJobTaskSchedule.getLogId();
if(logId == null){
log.debug("-------------发现节点{}不是重跑,执行日志节点数据初始化-----------",mythJobTaskSchedule);
logId = saveLog(mythJobTaskSchedule);
log.debug("------------{}节点的日志保存成功,日志ID为{}---------------",mythJobTaskSchedule,logId);
}
mythJobTaskSchedule.setLogId(logId);
Long triggerTime = mythJobTaskSchedule.getTriggerTime(); Long triggerTime = mythJobTaskSchedule.getTriggerTime();
TimerTask timerTask = null; TimerTask timerTask = null;
if (NodeTypeEnum.JAVA.getType().equals(mythJobTaskSchedule.getJobType())) { if (NodeTypeEnum.JAVA.getType().equals(mythJobTaskSchedule.getJobType())) {
...@@ -82,9 +75,9 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper { ...@@ -82,9 +75,9 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper {
//构建脚本调度执行器 //构建脚本调度执行器
timerTask = new ScriptExecutorJobTask(mythJobTaskSchedule); timerTask = new ScriptExecutorJobTask(mythJobTaskSchedule);
} }
//TODO 有个坑 如果这个类型不存在的话 这个节点就不会被执行和删除 有没有办法能够强制必须有类型呢?
if(timerTask != null){ if(timerTask != null){
log.debug("------节点{}的执行器{}执行添加到任务调度轮的操作-------",mythJobTaskSchedule,timerTask); log.debug("------节点{}的执行器{}执行添加到任务调度轮的操作-------",mythJobTaskSchedule,timerTask);
saveLog(mythJobTaskSchedule);
WorkRoulette.addJob(timerTask,triggerTime); WorkRoulette.addJob(timerTask,triggerTime);
jobTaskScheduleService.delete(mythJobTaskSchedule.getId()); jobTaskScheduleService.delete(mythJobTaskSchedule.getId());
} }
...@@ -106,14 +99,22 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper { ...@@ -106,14 +99,22 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper {
return LOCK_NAME; return LOCK_NAME;
} }
private Integer saveLog(JobTaskSchedule mythJobTaskSchedule){
JobTaskRunLogWithBLOBs jobTaskRunLog = new JobTaskRunLogWithBLOBs();
BeanUtils.copyProperties(mythJobTaskSchedule, jobTaskRunLog);
jobTaskRunLog.setLogId(null);
JobTaskRunLogServiceImpl mythJobTaskRunLogService = SpringUtil.getBean(JobTaskRunLogServiceImpl.class);
mythJobTaskRunLogService.saveJobTaskRunLog(jobTaskRunLog);
return jobTaskRunLog.getLogId(); private void saveLog(JobTaskSchedule mythJobTaskSchedule){
//如果是重跑就有logId
Integer logId = mythJobTaskSchedule.getLogId();
if(logId == null){
log.debug("-------------发现节点{}不是重跑,执行日志节点数据初始化-----------",mythJobTaskSchedule);
JobTaskRunLogWithBLOBs jobTaskRunLog = new JobTaskRunLogWithBLOBs();
BeanUtils.copyProperties(mythJobTaskSchedule, jobTaskRunLog);
jobTaskRunLog.setLogId(null);
JobTaskRunLogServiceImpl mythJobTaskRunLogService = SpringUtil.getBean(JobTaskRunLogServiceImpl.class);
mythJobTaskRunLogService.saveJobTaskRunLog(jobTaskRunLog);
logId = jobTaskRunLog.getLogId();
log.debug("------------{}节点的日志保存成功,日志ID为{}---------------",mythJobTaskSchedule,logId);
}
mythJobTaskSchedule.setLogId(logId);
} }
} }
...@@ -15,11 +15,11 @@ public class AddComplexPy1 { ...@@ -15,11 +15,11 @@ public class AddComplexPy1 {
public static void main(String[] args) { public static void main(String[] args) {
PluginPackage pluginPackage = new PluginPackage(); PluginPackage pluginPackage = new PluginPackage();
pluginPackage.setWorkspaceName("test"); pluginPackage.setWorkspaceName("huangfutest");
pluginPackage.setFlow(createFlow()); pluginPackage.setFlow(createFlow());
JobUtils.setRequestUrl("http://127.0.0.1:8081/myth-job-admin"); JobUtils.setRequestUrl("http://127.0.0.1:8081/myth-job-admin");
JobUtils.setTOKEN("test"); JobUtils.setTOKEN("test");
//JobUtils.addWorkspace("test"); //JobUtils.addWorkspace("huangfutest");
JobUtils.publish(pluginPackage); JobUtils.publish(pluginPackage);
} }
...@@ -37,7 +37,7 @@ public class AddComplexPy1 { ...@@ -37,7 +37,7 @@ public class AddComplexPy1 {
.scheduleFollow("1") .scheduleFollow("1")
.build(); .build();
pluginFlow.setName("复杂工作流11"); pluginFlow.setName("奥术大师多撒多");
pluginFlow.setDesc("测试多脚本复杂工作流创建"); pluginFlow.setDesc("测试多脚本复杂工作流创建");
pluginFlow.setConfig(build); pluginFlow.setConfig(build);
pluginFlow.setPrincipal("皇甫科星"); pluginFlow.setPrincipal("皇甫科星");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment