Commit 61d4c8f8 by huangfusuper

修改事实日志主键规则

parent 2f7bfe9f
...@@ -59,7 +59,7 @@ public class ApiNodeServiceImpl implements ApiNodeService { ...@@ -59,7 +59,7 @@ public class ApiNodeServiceImpl implements ApiNodeService {
RunNode runNode = JSON.parseObject(param, RunNode.class); RunNode runNode = JSON.parseObject(param, RunNode.class);
ValidationUtil.dataNotBank(runNode.getNodeId(), "节点id不允许为空!"); ValidationUtil.dataNotBank(runNode.getNodeId(), "节点id不允许为空!");
String runId = "REAL-EXEC-" + runNode.getNodeId(); String runId = "REAL:EXEC:" + runNode.getNodeId();
ValidationUtil.dataNotBank(runNode.getNodeName(), "节点名称不允许为空!"); ValidationUtil.dataNotBank(runNode.getNodeName(), "节点名称不允许为空!");
ValidationUtil.dataNotBank(runNode.getRunCmd(), "运行命令不允许为空!"); ValidationUtil.dataNotBank(runNode.getRunCmd(), "运行命令不允许为空!");
ValidationUtil.dataNotBank(runNode.getJobType(), "节点类型不允许为空!"); ValidationUtil.dataNotBank(runNode.getJobType(), "节点类型不允许为空!");
...@@ -99,7 +99,7 @@ public class ApiNodeServiceImpl implements ApiNodeService { ...@@ -99,7 +99,7 @@ public class ApiNodeServiceImpl implements ApiNodeService {
TimerTask timerTask = new ScriptExecutorJobTask(schedule); TimerTask timerTask = new ScriptExecutorJobTask(schedule);
WorkRoulette.addJob(timerTask, triggerTime); WorkRoulette.addJob(timerTask, triggerTime);
RunLog runLog = RunLog.builder().isEnd(false).runLog("等待服务器分配资源").build(); RunLog runLog = RunLog.builder().isEnd(false).runLog("等待服务器分配资源").build();
String runKey = "REAL-EXEC-" + logId; String runKey = "REAL:EXEC:" + logId;
stringRedisTemplate.convertAndSend(runKey, JSON.toJSONString(runLog, WriteClassName)); stringRedisTemplate.convertAndSend(runKey, JSON.toJSONString(runLog, WriteClassName));
...@@ -117,7 +117,7 @@ public class ApiNodeServiceImpl implements ApiNodeService { ...@@ -117,7 +117,7 @@ public class ApiNodeServiceImpl implements ApiNodeService {
public List<JobTaskRunLog> runHistory(String nodeId) { public List<JobTaskRunLog> runHistory(String nodeId) {
ValidationUtil.dataNotBank(nodeId, "nodeId不允许为空!"); ValidationUtil.dataNotBank(nodeId, "nodeId不允许为空!");
String runId = "REAL-EXEC-" + nodeId; String runId = "REAL:EXEC:" + nodeId;
List<JobTaskRunLog> jobTaskRunLogList = jobTaskRunLogMapper.findByRunId(runId); List<JobTaskRunLog> jobTaskRunLogList = jobTaskRunLogMapper.findByRunId(runId);
......
...@@ -110,9 +110,9 @@ public class ScriptExecutorJobTask implements TimerTask { ...@@ -110,9 +110,9 @@ public class ScriptExecutorJobTask implements TimerTask {
}catch (Exception e){ }catch (Exception e){
StringRedisTemplate stringRedisTemplate = (StringRedisTemplate) SpringUtil.getBean("stringRedisTemplate"); StringRedisTemplate stringRedisTemplate = (StringRedisTemplate) SpringUtil.getBean("stringRedisTemplate");
RunLog runLog = RunLog.builder().isEnd(true).isSuccess(false).runLog("执行资源异常" + e.getMessage()).build(); RunLog runLog = RunLog.builder().isEnd(true).isSuccess(false).runLog("执行资源异常" + e.getMessage()).build();
//stringRedisTemplate.convertAndSend("REAL-EXEC-" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName)); //stringRedisTemplate.convertAndSend("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
//使用redis 想队尾push一个值 //使用redis 想队尾push一个值
stringRedisTemplate.opsForList().rightPush("REAL-EXEC-" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName)); stringRedisTemplate.opsForList().rightPush("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
log.error("------执行机异常{}-----", e.getMessage()); log.error("------执行机异常{}-----", e.getMessage());
dispatchResponseDto.setMsg(e.getMessage()); dispatchResponseDto.setMsg(e.getMessage());
dispatchResponseDto.setCode(JobResultEnum.DISPATCH_FAIL.getCode()); dispatchResponseDto.setCode(JobResultEnum.DISPATCH_FAIL.getCode());
......
...@@ -70,7 +70,7 @@ public class MythJobProcess implements Callable<String>{ ...@@ -70,7 +70,7 @@ public class MythJobProcess implements Callable<String>{
this.completeLatch = new CountDownLatch(1); this.completeLatch = new CountDownLatch(1);
this.logId = logId; this.logId = logId;
this.stringRedisTemplate = stringRedisTemplate; this.stringRedisTemplate = stringRedisTemplate;
this.runKey = "REAL-EXEC-" + logId; this.runKey = "REAL:EXEC:" + logId;
} }
public MythJobProcess(final List<String> cmd, final Map<String, String> env, public MythJobProcess(final List<String> cmd, final Map<String, String> env,
......
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