Commit 63bcbcf5 by huangfusuper

执行节点监控

parent c0423366
package com.byit.thread.helper; package com.byit.thread.helper;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.byit.dto.plugin.RunLog;
import com.byit.model.JobTaskRunLog; import com.byit.model.JobTaskRunLog;
import com.byit.service.JobTaskRunLogService; import com.byit.service.JobTaskRunLogService;
import com.byit.thread.BaseThreadRunHelper; import com.byit.thread.BaseThreadRunHelper;
...@@ -10,6 +12,8 @@ import org.springframework.stereotype.Component; ...@@ -10,6 +12,8 @@ import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
import static com.alibaba.fastjson.serializer.SerializerFeature.WriteClassName;
/** /**
* @author huangfu * @author huangfu
*/ */
...@@ -23,7 +27,6 @@ public class UnfinishedNodeMonitoringRunHelper extends BaseThreadRunHelper { ...@@ -23,7 +27,6 @@ public class UnfinishedNodeMonitoringRunHelper extends BaseThreadRunHelper {
/** /**
* 心跳前缀 * 心跳前缀
*/ */
private static final String HEARTBEAT = "HEARTBEAT_";
private final StringRedisTemplate stringRedisTemplate; private final StringRedisTemplate stringRedisTemplate;
private final JobTaskRunLogService jobTaskRunLogService; private final JobTaskRunLogService jobTaskRunLogService;
...@@ -37,9 +40,10 @@ public class UnfinishedNodeMonitoringRunHelper extends BaseThreadRunHelper { ...@@ -37,9 +40,10 @@ public class UnfinishedNodeMonitoringRunHelper extends BaseThreadRunHelper {
List<JobTaskRunLog> tempRunNodeList = jobTaskRunLogService.findTempRunNodeList(); List<JobTaskRunLog> tempRunNodeList = jobTaskRunLogService.findTempRunNodeList();
if (CollectionUtil.isNotEmpty(tempRunNodeList)) { if (CollectionUtil.isNotEmpty(tempRunNodeList)) {
tempRunNodeList.forEach(nodeLog -> { tempRunNodeList.forEach(nodeLog -> {
log.debug("-----节点{}未执行完毕-----",nodeLog);
String runId = nodeLog.getRunId(); String runId = nodeLog.getRunId();
String key = HEARTBEAT + runId; RunLog runLog = RunLog.builder().isEnd(false).runLog(PENG).build();
stringRedisTemplate.opsForList().rightPush(key, PENG); stringRedisTemplate.opsForList().rightPush(runId, JSON.toJSONString(runLog, WriteClassName));
}); });
} }
return 5000L; return 5000L;
......
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