Commit 8993bc0b by huangfusuper

修改日志级别

parent 2b9a24fb
...@@ -61,14 +61,14 @@ public class EndAndNotWarningThreadRunHelper extends BaseThreadRunHelper { ...@@ -61,14 +61,14 @@ public class EndAndNotWarningThreadRunHelper extends BaseThreadRunHelper {
switch (runRecording.getAlarmlAction()) { switch (runRecording.getAlarmlAction()) {
//设置为完成时告警 //设置为完成时告警
case WHEN_DONE: case WHEN_DONE:
log.info("------工作流{},被设置为完成时告警-----",runRecording); log.debug("------工作流{},被设置为完成时告警-----",runRecording);
if (RunRecordingEnum.FLOW_STATUS_IS_END.getCode().equals(runRecording.getFlowStatus())) { if (RunRecordingEnum.FLOW_STATUS_IS_END.getCode().equals(runRecording.getFlowStatus())) {
runRecordingAndEmailService.saveEmailAndRunRecording(runRecording); runRecordingAndEmailService.saveEmailAndRunRecording(runRecording);
} }
break; break;
//失败时告警 //失败时告警
case FAILURE_DONE: case FAILURE_DONE:
log.info("------工作流{},被设置为失败时告警-----",runRecording); log.debug("------工作流{},被设置为失败时告警-----",runRecording);
if (RunRecordingEnum.RUN_FLOW_FAILURE.getCode().equals(runRecording.getFlowRunResult()) if (RunRecordingEnum.RUN_FLOW_FAILURE.getCode().equals(runRecording.getFlowRunResult())
|| RunRecordingEnum.RUN_FLOW_RE_FAILURE.getCode().equals(runRecording.getFlowRunResult())) { || RunRecordingEnum.RUN_FLOW_RE_FAILURE.getCode().equals(runRecording.getFlowRunResult())) {
runRecordingAndEmailService.saveEmailAndRunRecording(runRecording); runRecordingAndEmailService.saveEmailAndRunRecording(runRecording);
...@@ -76,14 +76,14 @@ public class EndAndNotWarningThreadRunHelper extends BaseThreadRunHelper { ...@@ -76,14 +76,14 @@ public class EndAndNotWarningThreadRunHelper extends BaseThreadRunHelper {
break; break;
//成功时告警 //成功时告警
case SUCCESS_DONE: case SUCCESS_DONE:
log.info("------工作流{},被设置为成功时告警-----",runRecording); log.debug("------工作流{},被设置为成功时告警-----",runRecording);
if (RunRecordingEnum.RUN_FLOW_SUCCESS.getCode().equals(runRecording.getFlowRunResult()) if (RunRecordingEnum.RUN_FLOW_SUCCESS.getCode().equals(runRecording.getFlowRunResult())
|| RunRecordingEnum.RUN_FLOW_RE_SUCCESS.getCode().equals(runRecording.getFlowRunResult())) { || RunRecordingEnum.RUN_FLOW_RE_SUCCESS.getCode().equals(runRecording.getFlowRunResult())) {
runRecordingAndEmailService.saveEmailAndRunRecording(runRecording); runRecordingAndEmailService.saveEmailAndRunRecording(runRecording);
} }
break; break;
default: default:
log.info("------工作流{},告警类别未知-----",runRecording); log.debug("------工作流{},告警类别未知-----",runRecording);
break; break;
} }
}); });
......
...@@ -46,32 +46,32 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper { ...@@ -46,32 +46,32 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper {
//查询所有符合条件的任务节点 //查询所有符合条件的任务节点
List<JobTaskSchedule> jobTaskSchedules = jobTaskScheduleService.findJobTaskScheduleByTriggerNextTimeLessThanEqual(nowTime + SCHEDULE_READ_MS); List<JobTaskSchedule> jobTaskSchedules = jobTaskScheduleService.findJobTaskScheduleByTriggerNextTimeLessThanEqual(nowTime + SCHEDULE_READ_MS);
if(CollectionUtil.isNotEmpty(jobTaskSchedules)){ if(CollectionUtil.isNotEmpty(jobTaskSchedules)){
log.info("------排期表查询到有需要存在的节点--------"); log.debug("------排期表查询到有需要存在的节点--------");
//循环遍历添加任务 //循环遍历添加任务
jobTaskSchedules.forEach(mythJobTaskSchedule ->{ jobTaskSchedules.forEach(mythJobTaskSchedule ->{
mythJobTaskSchedule.setRunParam(PlaceholderUtils.formatParam(mythJobTaskSchedule.getRunParam())); mythJobTaskSchedule.setRunParam(PlaceholderUtils.formatParam(mythJobTaskSchedule.getRunParam()));
//如果是重跑就有logId //如果是重跑就有logId
Integer logId = mythJobTaskSchedule.getLogId(); Integer logId = mythJobTaskSchedule.getLogId();
if(logId == null){ if(logId == null){
log.info("-------------发现节点{}不是重跑,执行日志节点数据初始化-----------",mythJobTaskSchedule); log.debug("-------------发现节点{}不是重跑,执行日志节点数据初始化-----------",mythJobTaskSchedule);
logId = saveLog(mythJobTaskSchedule); logId = saveLog(mythJobTaskSchedule);
log.info("------------{}节点的日志保存成功,日志ID为{}---------------",mythJobTaskSchedule,logId); log.debug("------------{}节点的日志保存成功,日志ID为{}---------------",mythJobTaskSchedule,logId);
} }
mythJobTaskSchedule.setLogId(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())) {
log.info("------节点{},开始构建java执行器-------",mythJobTaskSchedule); log.debug("------节点{},开始构建java执行器-------",mythJobTaskSchedule);
//构建调度执行器 //构建调度执行器
timerTask = new JavaBeanJobTask(mythJobTaskSchedule); timerTask = new JavaBeanJobTask(mythJobTaskSchedule);
}else if(NodeTypeEnum.SCRIPT.getType().equals(mythJobTaskSchedule.getJobType())){ }else if(NodeTypeEnum.SCRIPT.getType().equals(mythJobTaskSchedule.getJobType())){
log.info("------节点{},开始构建脚本执行器-------",mythJobTaskSchedule); log.debug("------节点{},开始构建脚本执行器-------",mythJobTaskSchedule);
//构建脚本调度执行器 //构建脚本调度执行器
timerTask = new ScriptExecutorJobTask(mythJobTaskSchedule); timerTask = new ScriptExecutorJobTask(mythJobTaskSchedule);
} }
//TODO 有个坑 如果这个类型不存在的话 这个节点就不会被执行和删除 有没有办法能够强制必须有类型呢? //TODO 有个坑 如果这个类型不存在的话 这个节点就不会被执行和删除 有没有办法能够强制必须有类型呢?
if(timerTask != null){ if(timerTask != null){
log.info("------节点{}的执行器{}执行添加到任务调度轮的操作-------",mythJobTaskSchedule,timerTask); log.debug("------节点{}的执行器{}执行添加到任务调度轮的操作-------",mythJobTaskSchedule,timerTask);
WorkRoulette.addJob(timerTask,triggerTime); WorkRoulette.addJob(timerTask,triggerTime);
jobTaskScheduleService.delete(mythJobTaskSchedule.getId()); jobTaskScheduleService.delete(mythJobTaskSchedule.getId());
} }
......
...@@ -158,7 +158,7 @@ public class TaskThreadRunHelper extends BaseThreadRunHelper { ...@@ -158,7 +158,7 @@ public class TaskThreadRunHelper extends BaseThreadRunHelper {
log.debug("--------------【{}的上级节点的失败节点已经全部重试完毕】------------------",thisJobTask); log.debug("--------------【{}的上级节点的失败节点已经全部重试完毕】------------------",thisJobTask);
//该节点如果为弱引用 //该节点如果为弱引用
if (NodePropertyEnum.WEAK_NODE.getCode().equals(thisJobTask.getSuperSuccessRun())) { if (NodePropertyEnum.WEAK_NODE.getCode().equals(thisJobTask.getSuperSuccessRun())) {
log.info("-------------【查询到有弱引用节点】-----------------"); log.debug("-------------【查询到有弱引用节点】-----------------");
//执行代码 //执行代码
runJobTask(thisJobTask,jobTaskSchedules); runJobTask(thisJobTask,jobTaskSchedules);
}else{ }else{
......
package com.byit.job;
import com.alibaba.fastjson.JSON;
import com.byit.dto.executor.ScriptParamAndPlaceholderDto;
import com.byit.dto.plugin.*;
import com.byit.utils.JobUtils;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* @author huanfgu
*/
public class AddComplexPy1 {
public static void main(String[] args) {
PluginPackage pluginPackage = new PluginPackage();
pluginPackage.setWorkspaceName("test");
pluginPackage.setFlow(createFlow());
JobUtils.setRequestUrl("http://127.0.0.1:8081");
JobUtils.setTOKEN("test");
JobUtils.publish(pluginPackage);
}
public static PluginFlow createFlow(){
PluginFlow pluginFlow = new PluginFlow();
//构建工作流信息
PluginFlowConfig build = PluginFlowConfig.builder().alarmEmail("huangfukexing@byitgroup.com")
.alarmlAction("1")
.execType("1")
.flowCron("0 0/1 * * * ? *")
.flowTimeout(TimeUnit.MINUTES.toMillis(30))
.priority("2")
.repeatCount(1)
.scheduleFollow("1")
.build();
pluginFlow.setName("复杂工作流");
pluginFlow.setDesc("测试多脚本复杂工作流创建");
pluginFlow.setConfig(build);
pluginFlow.setPrincipal("皇甫科星");
pluginFlow.setRePublish(false);
pluginFlow.setAuthor("huangfukexing");
pluginFlow.setNodeList(createNodes());
return pluginFlow;
}
/**
* 创建节点
* @return
*/
public static List<PluginBaseNode> createNodes(){
//构建开始节点
PluginNode startNode = new PluginNode();
PluginNodeConfig startConf = new PluginNodeConfig();
nodeSet(startNode,false);
startNode.setName("start");
startNode.setDesc("开始节点");
startNode.setScriptUrls("ddmp/M00/00/01/CgB4Al5wa6WAfhQ9AAAAN9Xm1mU1221.py");
confSet(startConf);
startNode.setConfig(startConf);
System.out.println("-----------------start 节点构建成功,开始构建node1节点,依赖start节点--------------------");
PluginNode node1 = new PluginNode();
PluginNodeConfig node1Conf = new PluginNodeConfig();
nodeSet(node1,true);
node1.setName("node1");
node1.setDesc("node1节点");
node1.setScriptUrls("ddmp/M00/00/00/CgB4Al5wa36AaUJ7AAAAiYy1k-k9801.py");
confSet(node1Conf);
node1.setConfig(node1Conf);
node1.setDependNodeNameList(Collections.singletonList("start"));
System.out.println("-----------------node1 节点构建成功,开始构建 end,node1--------------------");
PluginNode endNode = new PluginNode();
PluginNodeConfig endNodeConf = new PluginNodeConfig();
nodeSet(endNode,false);
endNode.setName("end");
endNode.setDesc("end节点");
endNode.setScriptUrls("ddmp/M00/00/01/CgB4Al5wa6WADyyrAAAANb42CIc7700.py");
confSet(endNodeConf);
endNode.setConfig(endNodeConf);
endNode.setDependNodeNameList(Collections.singletonList("node1"));
return Arrays.asList(startNode,node1,endNode);
}
/**
* 构建节点
* @param pluginNode
*/
private static void nodeSet(PluginNode pluginNode,boolean flag){
pluginNode.setAuthor("皇甫");
pluginNode.setJobType("SCRIPT");
pluginNode.setType("node");
pluginNode.setRunCommand("python ${biz_file}");
if(flag){
ScriptParamAndPlaceholderDto scriptParamAndPlaceholderDto = new ScriptParamAndPlaceholderDto();
Map<String,String> map = new HashMap<>();
map.put("name","皇甫科星");
scriptParamAndPlaceholderDto.setPlaceholder(map);
pluginNode.setRunParam(JSON.toJSONString(scriptParamAndPlaceholderDto));
}
}
/**
* 构建配置
* @param conf
*/
private static void confSet( PluginNodeConfig conf){
conf.setFailedRetryCount(2);
conf.setFailedRetryInterval(TimeUnit.MINUTES.toSeconds(2));
conf.setNodeTimeout(-1L);
conf.setPriority("1");
}
}
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