Commit 861bd8fd by huangfusuper

修改日志

parent 1b72b2a8
......@@ -32,8 +32,15 @@ public class RunScriptProcessingMachine implements ProcessingMachine {
@Override
public void executor(ScriptDto scriptDto, ProcessingNodeChain processingNodeChain) {
boolean isRunNode = scriptDto.getRunId().contains("REAL-EXEC-");
List<String> cmdList = Arrays.asList(scriptDto.getCommand().split(" "));
MythJobProcess mythJobProcess = new MythJobProcess(cmdList, null, null, scriptDto.getLogId(), stringRedisTemplate);
MythJobProcess mythJobProcess;
if(isRunNode) {
mythJobProcess = new MythJobProcess(cmdList, null, null, scriptDto.getLogId(), stringRedisTemplate);
}else {
mythJobProcess = new MythJobProcess(cmdList, null, null, scriptDto.getLogId(), null);
}
//保存日志
String logData = mythJobProcess.call();
//成功 是0 失败是其他的 杀死是-100
......
......@@ -88,13 +88,6 @@ public class MythJobProcess implements Callable<String>{
@SneakyThrows
@Override
public String call() {
RunLog startRunLog = RunLog.builder().isEnd(false).runLog("start").build();
//stringRedisTemplate.convertAndSend(runKey, JSON.toJSONString(runLog, WriteClassName))
//TODO 向队尾追加一个日志
Long startLong = stringRedisTemplate.opsForList().rightPush(runKey , JSON.toJSONString(startRunLog, WriteClassName));
if(startLong <= 0){
log.error("------日志信息加入redis异常,{}---------",startLong);
}
//判断是否执行过
if (this.isStarted() || this.isComplete()) {
throw new IllegalStateException("该过程只能使用一次");
......
......@@ -45,9 +45,11 @@ public class LogGobbler extends Thread {
this.buffer.append(line + "\n");
runLog.setRunLog(line);
//stringRedisTemplate.convertAndSend(runKey, JSON.toJSONString(runLog, WriteClassName))
if (stringRedisTemplate != null) {
//TODO 向队列队尾插入一个值
Long aLong = stringRedisTemplate.opsForList().rightPush(runKey, JSON.toJSONString(runLog, WriteClassName));
log.info("-------{}-------",aLong);
}
printLog(line);
}
} catch (final IOException e) {
......
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