Commit a9b6a88a by guominglei

插件端重跑节点

parent 8fefb13e
......@@ -420,6 +420,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
String runState = jsonObject.getString("runState");
ValidationUtil.dataNotBank(runState, "重跑机制不允许为空!");
//获取要重跑的运行记录id
String runId = jsonObject.getString("runId");
ValidationUtil.dataNotBank(runId, "运行实例id不允许为空!");
......@@ -434,10 +435,22 @@ public class ApiFlowServiceImpl implements ApiFlowService {
JobTaskRunLog jobTaskRunLog = jobTaskRunLogMapper.findByRunIdAndNodeId(runId, node.getNodeId());
ValidationUtil.dataNotNull(jobTaskRunLog, "查无此运行记录");
//校验通过,开始设置重跑
//判断重跑机制(单节点重跑,节点及下游重跑)
//获取当前时间
String reRunId = UUID.randomUUID().toString().replace("-","");
Long triggerTime = System.currentTimeMillis();
List<JobTask> jobTaskList = new ArrayList<>();
JobTask jobTask = new JobTask();
BeanUtils.copyProperties(node, jobTask);
jobTask.setTriggerTime(triggerTime);
jobTask.setTriggerStatus("1");
//校验通过,开始设置重跑
//判断重跑机制(单节点重跑,节点及下游重跑
if ("1".equals(runState)) {//如果是只重跑当前节点
jobTaskList.add(jobTask);
}
jobTaskMapper.saveJobTasks(jobTaskList);
}
......
......@@ -195,6 +195,12 @@ public class JobTask implements Serializable {
private String superSuccessRun;
/**
* 重跑的运行标识
*/
@ApiModelProperty("重跑的运行标识")
private String reRunId;
/**
*/
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -195,6 +195,12 @@ public class JobTaskSchedule implements Serializable {
private String superSuccessRun;
/**
* 重跑的运行标识
*/
@ApiModelProperty("重跑的运行标识")
private String reRunId;
/**
*/
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -32,6 +32,7 @@
<result column="run_command" jdbcType="VARCHAR" property="runCommand" />
<result column="flow_name" jdbcType="VARCHAR" property="flowName" />
<result column="super_success_run" jdbcType="CHAR" property="superSuccessRun"/>
<result column="re_run_id" jdbcType="VARCHAR" property="reRunId"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.byit.model.JobTask">
<!-- generated @mbg.generated date: 2019-12-25 -->
......@@ -43,7 +44,7 @@
job_type, handler_name, node_desc, node_name, map_flow_id, node_timeout, is_virtual,
plugin_urls, priority, failed_retry_interval, routing_strategy, run_id, run_param,
run_source_desc, script_urls, source_principal, trigger_time, trigger_status, version_name,
run_command,flow_name, super_success_run
run_command,flow_name, super_success_run, re_run_id
</sql>
<sql id="Blob_Column_List">
run_source
......@@ -162,6 +163,9 @@
<if test="superSuccessRun != null">
super_success_run,
</if>
<if test="reRunId != null">
re_run_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -254,6 +258,9 @@
<if test="superSuccessRun != null">
#{superSuccessRun,jdbcType=CHAR},
</if>
<if test="reRunId != null">
#{reRunId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
......@@ -263,7 +270,7 @@
job_type, handler_name, node_desc, node_name, map_flow_id, node_timeout, is_virtual,
plugin_urls, priority, failed_retry_interval, routing_strategy, run_id, run_param,
run_source_desc, script_urls, source_principal, trigger_time, trigger_status, version_name,
run_command,run_source,flow_name,super_success_run
run_command,run_source,flow_name,super_success_run, re_run_id
) values
<foreach collection="jobTasks" item="jobTask" separator =",">
(
......@@ -275,7 +282,7 @@
#{jobTask.runParam,jdbcType=VARCHAR},#{jobTask.runSourceDesc,jdbcType=VARCHAR},#{jobTask.scriptUrls,jdbcType=VARCHAR},
#{jobTask.sourcePrincipal,jdbcType=VARCHAR},#{jobTask.triggerTime,jdbcType=BIGINT},#{jobTask.triggerStatus,jdbcType=CHAR},
#{jobTask.versionName,jdbcType=VARCHAR},#{jobTask.runCommand,jdbcType=VARCHAR},#{jobTask.runSource,jdbcType=LONGVARCHAR},
#{jobTask.flowName,jdbcType=VARCHAR},#{jobTask.superSuccessRun,jdbcType=CHAR}
#{jobTask.flowName,jdbcType=VARCHAR},#{jobTask.superSuccessRun,jdbcType=CHAR}, ,#{jobTask.reRunId,jdbcType=VARCHAR}
)
</foreach>
......@@ -372,6 +379,9 @@
<if test="superSuccessRun != null">
super_success_run = #{superSuccessRun,jdbcType=CHAR},
</if>
<if test="reRunId != null">
re_run_id = #{reRunId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
......
......@@ -33,6 +33,7 @@
<result column="run_command" jdbcType="VARCHAR" property="runCommand"/>
<result column="flow_name" jdbcType="VARCHAR" property="flowName"/>
<result column="super_success_run" jdbcType="CHAR" property="superSuccessRun"/>
<result column="re_run_id" jdbcType="VARCHAR" property="reRunId"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.byit.model.JobTaskSchedule">
......@@ -44,7 +45,7 @@
job_type, handler_name, node_desc, node_name, map_flow_id, node_timeout, is_virtual,
plugin_urls, priority, failed_retry_interval, routing_strategy, run_id, run_param,
run_source_desc, script_urls, source_principal, trigger_time, trigger_status, version_name,
log_id, run_command,flow_name, super_success_run
log_id, run_command,flow_name, super_success_run, re_run_id
</sql>
<sql id="Blob_Column_List">
run_source
......@@ -170,6 +171,9 @@
<if test="superSuccessRun != null">
super_success_run,
</if>
<if test="reRunId != null">
re_run_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -265,6 +269,9 @@
<if test="superSuccessRun != null">
#{superSuccessRun,jdbcType=CHAR},
</if>
<if test="reRunId != null">
#{reRunId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
......@@ -278,7 +285,7 @@
run_id, run_param, run_source_desc,
script_urls, source_principal, trigger_time,
trigger_status, version_name, log_id,
run_command, run_source,flow_name, super_success_run
run_command, run_source,flow_name, super_success_run, re_run_id
)
values
<foreach collection="jobTaskSchedules" item="jobTaskSchedule" separator=",">
......@@ -302,7 +309,8 @@
#{jobTaskSchedule.triggerStatus,jdbcType=CHAR}, #{jobTaskSchedule.versionName,jdbcType=VARCHAR},
#{jobTaskSchedule.logId,jdbcType=INTEGER},
#{jobTaskSchedule.runCommand,jdbcType=VARCHAR}, #{jobTaskSchedule.runSource,jdbcType=LONGVARCHAR},
#{jobTaskSchedule.flowName,jdbcType=VARCHAR}, #{jobTaskSchedule.superSuccessRun,jdbcType=CHAR}
#{jobTaskSchedule.flowName,jdbcType=VARCHAR}, #{jobTaskSchedule.superSuccessRun,jdbcType=CHAR},
#{jobTaskSchedule.reRunId,jdbcType=VARCHAR},
)
</foreach>
</insert>
......@@ -401,6 +409,9 @@
<if test="superSuccessRun != null">
super_success_run = #{superSuccessRun,jdbcType=CHAR},
</if>
<if test="reRunId != null">
re_run_id = #{reRunId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
......
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