Commit 861bd8fd by huangfusuper

修改日志

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