Commit 0a7eea16 by huangfusuper

脚本类数据

parent cae3413c
...@@ -9,6 +9,7 @@ public enum RedisKeyNameEnum { ...@@ -9,6 +9,7 @@ public enum RedisKeyNameEnum {
* 调度中心公共参数 * 调度中心公共参数
*/ */
REDIS_PUBLIC_PARAM_KEY("myth:param:public:%s%s"), REDIS_PUBLIC_PARAM_KEY("myth:param:public:%s%s"),
REDIS_FLOW_ERROR_MSG_KEY("myth:error:msg:%s:%s:"),
; ;
private final String keyName; private final String keyName;
......
package com.byit.service.impl; package com.byit.service.impl;
import com.byit.enums.EmailEnum; import com.byit.enums.EmailEnum;
import com.byit.enums.RedisKeyNameEnum;
import com.byit.enums.RunRecordingEnum; import com.byit.enums.RunRecordingEnum;
import com.byit.enums.task.RunResultEnum; import com.byit.enums.task.RunResultEnum;
import com.byit.enums.task.RunTypeEnum; import com.byit.enums.task.RunTypeEnum;
...@@ -8,8 +9,9 @@ import com.byit.model.JobTaskRunLogWithBLOBs; ...@@ -8,8 +9,9 @@ import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.model.JobTaskSchedule; import com.byit.model.JobTaskSchedule;
import com.byit.service.FastRunLogService; import com.byit.service.FastRunLogService;
import com.byit.service.JobTaskRunLogService; import com.byit.service.JobTaskRunLogService;
import com.byit.util.SpringUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
...@@ -22,9 +24,11 @@ import java.util.Date; ...@@ -22,9 +24,11 @@ import java.util.Date;
public class FastRunLogServiceImpl implements FastRunLogService { public class FastRunLogServiceImpl implements FastRunLogService {
private final JobTaskRunLogService jobTaskRunLogService; private final JobTaskRunLogService jobTaskRunLogService;
public static final String LINE = "\n"; public static final String LINE = "\n";
private final StringRedisTemplate stringRedisTemplate;
public FastRunLogServiceImpl(JobTaskRunLogService jobTaskRunLogService) { public FastRunLogServiceImpl(JobTaskRunLogService jobTaskRunLogService, StringRedisTemplate stringRedisTemplate) {
this.jobTaskRunLogService = jobTaskRunLogService; this.jobTaskRunLogService = jobTaskRunLogService;
this.stringRedisTemplate = stringRedisTemplate;
} }
@Override @Override
...@@ -77,6 +81,12 @@ public class FastRunLogServiceImpl implements FastRunLogService { ...@@ -77,6 +81,12 @@ public class FastRunLogServiceImpl implements FastRunLogService {
}else{ }else{
jobTaskRunLog.setRunMsg(msg+ LINE); jobTaskRunLog.setRunMsg(msg+ LINE);
} }
String format = String.format(RedisKeyNameEnum.REDIS_FLOW_ERROR_MSG_KEY.getKeyName(), mythJobTaskSchedule.getRunId(), mythJobTaskSchedule.getFlowName());
String errorMsg = stringRedisTemplate.opsForValue().get(format);
if(StringUtils.isNoneBlank(errorMsg)) {
jobTaskRunLog.setRunMsg(errorMsg+ LINE);
stringRedisTemplate.delete(format);
}
jobTaskRunLog.setRunCount(jobTaskRunLogById.getRunCount()+1); jobTaskRunLog.setRunCount(jobTaskRunLogById.getRunCount()+1);
jobTaskRunLogService.updateJobTaskRunLogWithBLOBs(jobTaskRunLog); jobTaskRunLogService.updateJobTaskRunLogWithBLOBs(jobTaskRunLog);
log.info("-----------saveErrorLog--保存KILL脚本调度日志结束------------"); log.info("-----------saveErrorLog--保存KILL脚本调度日志结束------------");
......
...@@ -2,11 +2,13 @@ package com.byit.service.impl; ...@@ -2,11 +2,13 @@ package com.byit.service.impl;
import com.byit.dto.BeanStrategyPackage; import com.byit.dto.BeanStrategyPackage;
import com.byit.enums.NodeNameEnum; import com.byit.enums.NodeNameEnum;
import com.byit.enums.RedisKeyNameEnum;
import com.byit.enums.RunRecordingEnum; import com.byit.enums.RunRecordingEnum;
import com.byit.enums.ScheduleTypeEnum; import com.byit.enums.ScheduleTypeEnum;
import com.byit.enums.task.RunResultEnum; import com.byit.enums.task.RunResultEnum;
import com.byit.event.FlowScanEndEvent; import com.byit.event.FlowScanEndEvent;
import com.byit.job.utils.CronExpression; import com.byit.job.utils.CronExpression;
import com.byit.job.utils.MythLogUtils;
import com.byit.model.Flow; import com.byit.model.Flow;
import com.byit.model.JobTask; import com.byit.model.JobTask;
import com.byit.model.Node; import com.byit.model.Node;
...@@ -22,6 +24,7 @@ import org.springframework.beans.BeanUtils; ...@@ -22,6 +24,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -40,6 +43,7 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis ...@@ -40,6 +43,7 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis
private final JobTaskService jobTaskService; private final JobTaskService jobTaskService;
private final FlowService flowService; private final FlowService flowService;
private ApplicationEventPublisher applicationEventPublisher; private ApplicationEventPublisher applicationEventPublisher;
private final StringRedisTemplate stringRedisTemplate;
@Value("${server.port}") @Value("${server.port}")
private Integer serverPort; private Integer serverPort;
/** /**
...@@ -48,10 +52,11 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis ...@@ -48,10 +52,11 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis
private final NodeDependencyService nodeDependencyService; private final NodeDependencyService nodeDependencyService;
public RunNodeServiceImpl(RunRecordingService runRecordingService, JobTaskService jobTaskService, public RunNodeServiceImpl(RunRecordingService runRecordingService, JobTaskService jobTaskService,
FlowService flowService, NodeDependencyService nodeDependencyService) { FlowService flowService, StringRedisTemplate stringRedisTemplate, NodeDependencyService nodeDependencyService) {
this.runRecordingService = runRecordingService; this.runRecordingService = runRecordingService;
this.jobTaskService = jobTaskService; this.jobTaskService = jobTaskService;
this.flowService = flowService; this.flowService = flowService;
this.stringRedisTemplate = stringRedisTemplate;
this.nodeDependencyService = nodeDependencyService; this.nodeDependencyService = nodeDependencyService;
} }
...@@ -120,7 +125,8 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis ...@@ -120,7 +125,8 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis
} }
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); String format = String.format(RedisKeyNameEnum.REDIS_FLOW_ERROR_MSG_KEY.getKeyName(), build.getRunId(), build.getFlowName());
stringRedisTemplate.opsForValue().set(format, MythLogUtils.getMessage(e));
build.setFlowStatus(RunRecordingEnum.FLOW_STATUS_IS_END.getCode()); build.setFlowStatus(RunRecordingEnum.FLOW_STATUS_IS_END.getCode());
build.setFlowRunResult(RunResultEnum.RUN_ERROR.getCode()); build.setFlowRunResult(RunResultEnum.RUN_ERROR.getCode());
build.setFailFast(RunRecordingEnum.FAIL_FAST_YES.getCode()); build.setFailFast(RunRecordingEnum.FAIL_FAST_YES.getCode());
......
...@@ -2,11 +2,10 @@ package com.byit.service.mapservice.impl; ...@@ -2,11 +2,10 @@ package com.byit.service.mapservice.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.byit.dto.BeanStrategyPackage; import com.byit.dto.BeanStrategyPackage;
import com.byit.dto.RunRecordingWrapped;
import com.byit.enums.*; import com.byit.enums.*;
import com.byit.enums.task.RunResultEnum; import com.byit.enums.task.RunResultEnum;
import com.byit.job.utils.CronExpression; import com.byit.job.utils.CronExpression;
import com.byit.job.utils.DateUtil; import com.byit.job.utils.MythLogUtils;
import com.byit.model.*; import com.byit.model.*;
import com.byit.service.*; import com.byit.service.*;
import com.byit.service.mapservice.RunRecordingAndJobTaskService; import com.byit.service.mapservice.RunRecordingAndJobTaskService;
...@@ -16,6 +15,7 @@ import com.byit.util.SpringUtil; ...@@ -16,6 +15,7 @@ import com.byit.util.SpringUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -41,6 +41,7 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask ...@@ -41,6 +41,7 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask
private final JobTaskService jobTaskService; private final JobTaskService jobTaskService;
private final WaitingRecordService waitingRecordService; private final WaitingRecordService waitingRecordService;
private final WaitingTaskService taskService; private final WaitingTaskService taskService;
private final StringRedisTemplate stringRedisTemplate;
/** /**
* 节点依赖查询操作 * 节点依赖查询操作
*/ */
...@@ -48,7 +49,7 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask ...@@ -48,7 +49,7 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask
public RunRecordingAndJobTaskServiceImpl(JobTaskRunLogService jobTaskRunLogService, NodeService nodeService, public RunRecordingAndJobTaskServiceImpl(JobTaskRunLogService jobTaskRunLogService, NodeService nodeService,
FlowService flowService, RunRecordingService runRecordingService, FlowService flowService, RunRecordingService runRecordingService,
JobTaskService jobTaskService, WaitingRecordService waitingRecordService, WaitingTaskService taskService, NodeDependencyService nodeDependencyService) { JobTaskService jobTaskService, WaitingRecordService waitingRecordService, WaitingTaskService taskService, StringRedisTemplate stringRedisTemplate, NodeDependencyService nodeDependencyService) {
this.jobTaskRunLogService = jobTaskRunLogService; this.jobTaskRunLogService = jobTaskRunLogService;
this.nodeService = nodeService; this.nodeService = nodeService;
this.flowService = flowService; this.flowService = flowService;
...@@ -56,6 +57,7 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask ...@@ -56,6 +57,7 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask
this.jobTaskService = jobTaskService; this.jobTaskService = jobTaskService;
this.waitingRecordService = waitingRecordService; this.waitingRecordService = waitingRecordService;
this.taskService = taskService; this.taskService = taskService;
this.stringRedisTemplate = stringRedisTemplate;
this.nodeDependencyService = nodeDependencyService; this.nodeDependencyService = nodeDependencyService;
} }
/** /**
...@@ -282,7 +284,8 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask ...@@ -282,7 +284,8 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask
} }
} }
}catch (Exception e) { }catch (Exception e) {
e.printStackTrace(); String format = String.format(RedisKeyNameEnum.REDIS_FLOW_ERROR_MSG_KEY.getKeyName(), runRecording.getRunId(), runRecording.getFlowName());
stringRedisTemplate.opsForValue().set(format, MythLogUtils.getMessage(e));
runRecording.setFlowStatus(RunRecordingEnum.FLOW_STATUS_IS_END.getCode()); runRecording.setFlowStatus(RunRecordingEnum.FLOW_STATUS_IS_END.getCode());
runRecording.setFlowRunResult(RunResultEnum.RUN_ERROR.getCode()); runRecording.setFlowRunResult(RunResultEnum.RUN_ERROR.getCode());
runRecording.setFailFast(RunRecordingEnum.FAIL_FAST_YES.getCode()); runRecording.setFailFast(RunRecordingEnum.FAIL_FAST_YES.getCode());
......
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