Commit b93cdd5c by huangfusuper

日志节点增加脚本路径

parent 7b0e1073
......@@ -202,6 +202,9 @@ public class JobTaskRunLog implements Serializable {
*/
@ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行")
private Integer scheduleType;
@ApiModelProperty("脚本路径")
private String scriptUrls;
/**
*
*/
......
......@@ -2,6 +2,7 @@ package com.byit.thread.helper;
import cn.hutool.core.collection.CollectionUtil;
import com.byit.enums.NodeTypeEnum;
import com.byit.enums.ScheduleTypeEnum;
import com.byit.job.WorkRoulette;
import com.byit.job.utils.PlaceholderUtils;
import com.byit.model.JobTaskRunLogWithBLOBs;
......@@ -50,7 +51,10 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper {
log.debug("------排期表查询到有需要存在的节点--------");
//循环遍历添加任务
jobTaskSchedules.forEach(mythJobTaskSchedule ->{
if (ScheduleTypeEnum.NORMAL.getCode().equals(mythJobTaskSchedule.getScheduleType())) {
mythJobTaskSchedule.setRunParam(PlaceholderUtils.formatParam(mythJobTaskSchedule.getRunParam()));
}
//如果是重跑就有logId
Integer logId = mythJobTaskSchedule.getLogId();
if(logId == null){
......
package com.byit.thread.helper;
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.model.JobTask;
import com.byit.model.JobTaskRunLog;
......@@ -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.isEmpty(dependIdByNodeId)){
throw new BusinessException(NodeRunStatusPropertyEnum.NODE_RELY_ERROR.getMsg());
......
......@@ -33,6 +33,7 @@
<result column="node_depend" jdbcType="VARCHAR" property="nodeDepend"/>
<result column="operator" jdbcType="VARCHAR" property="operator"/>
<result column="schedule_type" jdbcType="INTEGER" property="scheduleType"/>
<result column="script_urls" jdbcType="VARCHAR" property="scriptUrls"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.byit.model.JobTaskRunLogWithBLOBs">
<result column="run_msg" jdbcType="LONGVARCHAR" property="runMsg" />
......@@ -42,7 +43,7 @@
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,
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 id="Blob_Column_List">
run_msg, trigger_msg
......@@ -255,6 +256,9 @@
<if test="scheduleType != null">
schedule_type,
</if>
<if test="scriptUrls != null">
script_urls,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="logId != null">
......@@ -356,6 +360,9 @@
<if test="scheduleType != null">
#{scheduleType,jdbcType=INTEGER},
</if>
<if test="scriptUrls != null">
#{scriptUrls,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateJobTaskRunLogWithBLOBs" parameterType="com.byit.model.JobTaskRunLogWithBLOBs">
......@@ -457,6 +464,9 @@
<if test="scheduleType != null">
schedule_type = #{scheduleType,jdbcType=INTEGER},
</if>
<if test="scriptUrls != null">
script_urls = #{scriptUrls,jdbcType=VARCHAR},
</if>
</set>
where log_id = #{logId,jdbcType=INTEGER}
</update>
......@@ -553,6 +563,9 @@
<if test="scheduleType != null">
schedule_type = #{scheduleType,jdbcType=INTEGER},
</if>
<if test="scriptUrls != null">
script_urls = #{scriptUrls,jdbcType=VARCHAR},
</if>
</set>
where log_id = #{logId,jdbcType=INTEGER}
</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;
import com.byit.annotations.JobHandler;
import com.byit.executor.handler.interfaces.IJobHandler;
import com.byit.model.PluginConfigModel;
import com.byit.rpc.ServerRunThread;
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 @@
<artifactId>dom4j</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.byit.server;
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
public ReturnResult<String> execute(String param) throws Exception {
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