Commit 96e5fb9e by huangfusuper

改变获取逻辑

parent 1051a227
......@@ -90,6 +90,7 @@ public class ApiNodeServiceImpl implements ApiNodeService {
schedule.setJobType(runNode.getJobType());
schedule.setTriggerTime(triggerTime);
schedule.setScheduleType(ScheduleTypeEnum.REAL.getCode());
schedule.setHandlerName(runNode.getHandlerName());
String runCommand = schedule.getRunCommand();
......
......@@ -21,6 +21,8 @@ import io.netty.util.TimerTask;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
import java.util.Date;
import static com.alibaba.fastjson.serializer.SerializerFeature.WriteClassName;
/**
......@@ -78,9 +80,10 @@ public class JavaNodeExecutorTask implements TimerTask {
communicationParam.setBody(mythJobTaskSchedule.getRunParam());
request.setParam(communicationParam);
request.setJobName(mythJobTaskSchedule.getNodeName());
request.setJobName(mythJobTaskSchedule.getHandlerName());
request.setExtension(jobTaskRunLogById.getLogId()+"");
jobTaskRunLogById.setLogId(jobTaskRunLogById.getLogId());
jobTaskRunLogById.setStartTime(new Date());
PluginRpcResponsePacket pluginRpcResponsePacket = service.runJava(request);
if(pluginRpcResponsePacket.isStatus()){
......@@ -90,13 +93,19 @@ public class JavaNodeExecutorTask implements TimerTask {
}
jobTaskRunLogById.setTriggerMsg(pluginRpcResponsePacket.getMsg());
jobTaskRunLogById.setJobGroupIp(pluginRpcResponsePacket.getRunIp());
jobTaskRunLogById.setRunParams(mythJobTaskSchedule.getRunParam());
jobTaskRunLogById.setRunType("2");
jobTaskRunLogById.setAlertEnd("1");
}catch (Exception e){
StringRedisTemplate stringRedisTemplate = (StringRedisTemplate) SpringUtil.getBean("stringRedisTemplate");
RunLog runLog = RunLog.builder().isEnd(true).isSuccess(false).runLog("执行资源异常" + e.getMessage()).build();
//stringRedisTemplate.convertAndSend("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
//使用redis 想队尾push一个值
stringRedisTemplate.opsForList().rightPush("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
if (mythJobTaskSchedule.getScheduleType().equals(4)) {
StringRedisTemplate stringRedisTemplate = (StringRedisTemplate) SpringUtil.getBean("stringRedisTemplate");
RunLog runLog = RunLog.builder().isEnd(true).isSuccess(false).runLog("执行资源异常" + e.getMessage()).build();
//stringRedisTemplate.convertAndSend("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
//使用redis 想队尾push一个值
stringRedisTemplate.opsForList().rightPush("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
}
log.error("------执行机异常{}-----", e.getMessage());
jobTaskRunLogById.setTriggerCode(RunResultEnum.TRIGGER_ERROR.getCode());
jobTaskRunLogById.setRunCode(RunResultEnum.RUN_ERROR.getCode());
......
......@@ -103,11 +103,14 @@ public class ScriptExecutorJobTask implements TimerTask {
scriptDto.setLogRemotePath(jobTaskRunLogById.getLogRemotelyPath());
dispatchResponseDto = runScriptService.runScript(scriptDto);
}catch (Exception e){
StringRedisTemplate stringRedisTemplate = (StringRedisTemplate) SpringUtil.getBean("stringRedisTemplate");
RunLog runLog = RunLog.builder().isEnd(true).isSuccess(false).runLog("执行资源异常" + e.getMessage()).build();
//stringRedisTemplate.convertAndSend("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
//使用redis 想队尾push一个值
stringRedisTemplate.opsForList().rightPush("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
if (mythJobTaskSchedule.getScheduleType().equals(4)) {
StringRedisTemplate stringRedisTemplate = (StringRedisTemplate) SpringUtil.getBean("stringRedisTemplate");
RunLog runLog = RunLog.builder().isEnd(true).isSuccess(false).runLog("执行资源异常" + e.getMessage()).build();
//stringRedisTemplate.convertAndSend("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
//使用redis 想队尾push一个值
stringRedisTemplate.opsForList().rightPush("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
}
log.error("------执行机异常{}-----", e.getMessage());
dispatchResponseDto.setMsg(e.getMessage());
dispatchResponseDto.setCode(JobResultEnum.DISPATCH_FAIL.getCode());
......
......@@ -43,6 +43,8 @@ public class RunNode implements Serializable {
*/
private String runSource;
private String handlerName;
/**
* 脚本类型
*/
......
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