Commit b93cdd5c by huangfusuper

日志节点增加脚本路径

parent 7b0e1073
...@@ -202,6 +202,9 @@ public class JobTaskRunLog implements Serializable { ...@@ -202,6 +202,9 @@ public class JobTaskRunLog implements Serializable {
*/ */
@ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行") @ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行")
private Integer scheduleType; private Integer scheduleType;
@ApiModelProperty("脚本路径")
private String scriptUrls;
/** /**
* *
*/ */
......
...@@ -2,6 +2,7 @@ package com.byit.thread.helper; ...@@ -2,6 +2,7 @@ package com.byit.thread.helper;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.byit.enums.NodeTypeEnum; import com.byit.enums.NodeTypeEnum;
import com.byit.enums.ScheduleTypeEnum;
import com.byit.job.WorkRoulette; import com.byit.job.WorkRoulette;
import com.byit.job.utils.PlaceholderUtils; import com.byit.job.utils.PlaceholderUtils;
import com.byit.model.JobTaskRunLogWithBLOBs; import com.byit.model.JobTaskRunLogWithBLOBs;
...@@ -50,7 +51,10 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper { ...@@ -50,7 +51,10 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper {
log.debug("------排期表查询到有需要存在的节点--------"); log.debug("------排期表查询到有需要存在的节点--------");
//循环遍历添加任务 //循环遍历添加任务
jobTaskSchedules.forEach(mythJobTaskSchedule ->{ jobTaskSchedules.forEach(mythJobTaskSchedule ->{
mythJobTaskSchedule.setRunParam(PlaceholderUtils.formatParam(mythJobTaskSchedule.getRunParam())); if (ScheduleTypeEnum.NORMAL.getCode().equals(mythJobTaskSchedule.getScheduleType())) {
mythJobTaskSchedule.setRunParam(PlaceholderUtils.formatParam(mythJobTaskSchedule.getRunParam()));
}
//如果是重跑就有logId //如果是重跑就有logId
Integer logId = mythJobTaskSchedule.getLogId(); Integer logId = mythJobTaskSchedule.getLogId();
if(logId == null){ if(logId == null){
......
package com.byit.thread.helper; package com.byit.thread.helper;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.byit.enums.*; import com.byit.enums.FlowPropertyEnum;
import com.byit.enums.NodeNameEnum;
import com.byit.enums.NodePropertyEnum;
import com.byit.enums.NodeRunStatusPropertyEnum;
import com.byit.job.exceptions.BusinessException; import com.byit.job.exceptions.BusinessException;
import com.byit.model.JobTask; import com.byit.model.JobTask;
import com.byit.model.JobTaskRunLog; import com.byit.model.JobTaskRunLog;
...@@ -137,15 +140,8 @@ public class TaskThreadRunHelper extends BaseThreadRunHelper { ...@@ -137,15 +140,8 @@ public class TaskThreadRunHelper extends BaseThreadRunHelper {
} }
} }
String runId;
if(ScheduleTypeEnum.REPEAT.getCode() .equals(thisJobTask.getScheduleType()) ){
runId = thisJobTask.getReRunId();
}else{
runId = thisJobTask.getRunId();
}
//这里返回的是上级节点的日志执行情况 把运行中的数据给过滤掉了 //这里返回的是上级节点的日志执行情况 把运行中的数据给过滤掉了
List<JobTaskRunLog> jobTaskRunLogList = jobTaskRunLogService.findJobTaskRunLogNotEndNodeByRunCodeCount(dependIdByNodeId, runId); List<JobTaskRunLog> jobTaskRunLogList = jobTaskRunLogService.findJobTaskRunLogNotEndNodeByRunCodeCount(dependIdByNodeId, thisJobTask.getRunId());
if (CollectionUtil.isNotEmpty(jobTaskRunLogList)) { if (CollectionUtil.isNotEmpty(jobTaskRunLogList)) {
if(CollectionUtil.isEmpty(dependIdByNodeId)){ if(CollectionUtil.isEmpty(dependIdByNodeId)){
throw new BusinessException(NodeRunStatusPropertyEnum.NODE_RELY_ERROR.getMsg()); throw new BusinessException(NodeRunStatusPropertyEnum.NODE_RELY_ERROR.getMsg());
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
<result column="node_depend" jdbcType="VARCHAR" property="nodeDepend"/> <result column="node_depend" jdbcType="VARCHAR" property="nodeDepend"/>
<result column="operator" jdbcType="VARCHAR" property="operator"/> <result column="operator" jdbcType="VARCHAR" property="operator"/>
<result column="schedule_type" jdbcType="INTEGER" property="scheduleType"/> <result column="schedule_type" jdbcType="INTEGER" property="scheduleType"/>
<result column="script_urls" jdbcType="VARCHAR" property="scriptUrls"/>
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.byit.model.JobTaskRunLogWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.byit.model.JobTaskRunLogWithBLOBs">
<result column="run_msg" jdbcType="LONGVARCHAR" property="runMsg" /> <result column="run_msg" jdbcType="LONGVARCHAR" property="runMsg" />
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
log_id, failed_remaining_count, version_name, flow_id, flow_name, job_group_id, handler_name, log_id, failed_remaining_count, version_name, flow_id, flow_name, job_group_id, handler_name,
node_name, is_virtual, run_code, run_params, start_time, run_type, trigger_code, node_name, is_virtual, run_code, run_params, start_time, run_type, trigger_code,
trigger_time, job_group_ip, map_flow_id, run_command, end_time, node_id,job_type,alert_end,run_id,re_run_id trigger_time, job_group_ip, map_flow_id, run_command, end_time, node_id,job_type,alert_end,run_id,re_run_id
,log_file_name, super_success_run, run_count, log_remotely_path, node_depend, operator, schedule_type ,log_file_name, super_success_run, run_count, log_remotely_path, node_depend, operator, schedule_type,script_urls
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
run_msg, trigger_msg run_msg, trigger_msg
...@@ -255,6 +256,9 @@ ...@@ -255,6 +256,9 @@
<if test="scheduleType != null"> <if test="scheduleType != null">
schedule_type, schedule_type,
</if> </if>
<if test="scriptUrls != null">
script_urls,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="logId != null"> <if test="logId != null">
...@@ -356,6 +360,9 @@ ...@@ -356,6 +360,9 @@
<if test="scheduleType != null"> <if test="scheduleType != null">
#{scheduleType,jdbcType=INTEGER}, #{scheduleType,jdbcType=INTEGER},
</if> </if>
<if test="scriptUrls != null">
#{scriptUrls,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<update id="updateJobTaskRunLogWithBLOBs" parameterType="com.byit.model.JobTaskRunLogWithBLOBs"> <update id="updateJobTaskRunLogWithBLOBs" parameterType="com.byit.model.JobTaskRunLogWithBLOBs">
...@@ -457,6 +464,9 @@ ...@@ -457,6 +464,9 @@
<if test="scheduleType != null"> <if test="scheduleType != null">
schedule_type = #{scheduleType,jdbcType=INTEGER}, schedule_type = #{scheduleType,jdbcType=INTEGER},
</if> </if>
<if test="scriptUrls != null">
script_urls = #{scriptUrls,jdbcType=VARCHAR},
</if>
</set> </set>
where log_id = #{logId,jdbcType=INTEGER} where log_id = #{logId,jdbcType=INTEGER}
</update> </update>
...@@ -553,6 +563,9 @@ ...@@ -553,6 +563,9 @@
<if test="scheduleType != null"> <if test="scheduleType != null">
schedule_type = #{scheduleType,jdbcType=INTEGER}, schedule_type = #{scheduleType,jdbcType=INTEGER},
</if> </if>
<if test="scriptUrls != null">
script_urls = #{scriptUrls,jdbcType=VARCHAR},
</if>
</set> </set>
where log_id = #{logId,jdbcType=INTEGER} where log_id = #{logId,jdbcType=INTEGER}
</update> </update>
......
package com.byit.executor.handler.impl;
import com.byit.dto.web.ReturnResult;
import com.byit.executor.handler.BaseJobHandler;
import com.byit.executor.handler.interfaces.IJobHandler;
/**
* @program: byit-myth-job->GlueJobHandler
* @description: JAVA任务节点处理程序
* @author: huangfu
* @date: 2019/11/13 16:23
**/
public class GlueJobHandler extends BaseJobHandler {
/**
* 任务实例
*/
private IJobHandler jobHandler;
/**
* 作业更新时间
*/
private long glueUpdateTime;
public GlueJobHandler(IJobHandler jobHandler, long glueUpdateTime) {
this.jobHandler = jobHandler;
this.glueUpdateTime = glueUpdateTime;
}
/**
* 回调任务节点
* @param param
* @return
* @throws Exception
*/
@Override
public ReturnResult<String> execute(String param) throws Exception {
return jobHandler.execute(param);
}
}
package com.byit.executor.handler.impl;
import com.byit.dto.web.ReturnResult;
import com.byit.enums.GlueTypeEnum;
import com.byit.executor.handler.BaseJobHandler;
/**
* @program: byit-myth-job->ScriptJobHandler
* @description: 解析脚本的专用类
* @author: huangfu
* @date: 2019/11/14 14:46
**/
public class ScriptJobHandler extends BaseJobHandler {
private int jobId;
private String scriptSource;
private long scriptUpdateTime;
private GlueTypeEnum glueTypeEnum;
public ScriptJobHandler(int jobId, String scriptSource, long scriptUpdateTime, GlueTypeEnum glueTypeEnum) {
this.jobId = jobId;
this.scriptSource = scriptSource;
this.scriptUpdateTime = scriptUpdateTime;
this.glueTypeEnum = glueTypeEnum;
}
@Override
public ReturnResult<String> execute(String param) throws Exception {
System.out.println("-----------------------脚本执行-------------------");
return ReturnResult.SUCCESS;
}
}
package com.byit.launcher; package com.byit.launcher;
import com.byit.annotations.JobHandler;
import com.byit.executor.handler.interfaces.IJobHandler;
import com.byit.model.PluginConfigModel; import com.byit.model.PluginConfigModel;
import com.byit.rpc.ServerRunThread; import com.byit.rpc.ServerRunThread;
import com.byit.utils.XmlParseUtil; import com.byit.utils.XmlParseUtil;
......
package com.byit.annotations;
import java.lang.annotation.*;
/**
* 任务设置
* @author huangfu
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface TaskHandler {
/**
* cron表达式
* @return cron表达式
*/
String cron() default "";
/**
* 任务名称
* @return 任务名称
*/
String taskName();
/**
* 是否自动发布
* @return 是否自动发布
*/
boolean autoPublish() default false;
}
...@@ -27,5 +27,12 @@ ...@@ -27,5 +27,12 @@
<artifactId>dom4j</artifactId> <artifactId>dom4j</artifactId>
<version>2.1.1</version> <version>2.1.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package com.byit.server; package com.byit.server;
import com.byit.dto.web.ReturnResult; import com.byit.dto.web.ReturnResult;
import com.byit.executor.handler.interfaces.IJobHandler; import com.byit.executor.handler.BaseJobHandler;
public class SendEmailTest implements IJobHandler { public class SendEmailTest extends BaseJobHandler {
@Override @Override
public ReturnResult<String> execute(String param) throws Exception { public ReturnResult<String> execute(String param) throws Exception {
return null; return null;
......
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