Glue(Shell) 等脚本任务支持失败重试;

master
xuxueli 7 years ago
parent ea5b3541e4
commit c48cb6eb25
  1. 2
      doc/XXL-JOB官方文档.md
  2. 18
      xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml
  3. 2
      xxl-job-core/src/main/java/com/xxl/job/core/handler/impl/ScriptJobHandler.java

@ -925,7 +925,7 @@ echo "分片总数 total = $3"
--- | --- | ---
成功 | IJobHandler.SUCCESS | 0
失败 | IJobHandler.FAIL | -1(其他)
失败重试 | IJobHandler.FAIL_RETRY | 501
失败重试 | IJobHandler.FAIL_RETRY | 101
## 六、版本更新日志

@ -45,7 +45,7 @@
SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="jobGroup != null and jobGroup != ''">
<if test="jobGroup gt 0">
AND t.job_group = #{jobGroup}
</if>
<if test="jobId gt 0">
@ -62,12 +62,13 @@
</if>
<if test="logStatus == 2" >
AND (
(t.trigger_code <![CDATA[ > ]]> 0 AND t.trigger_code!=200) ||
(t.handle_code <![CDATA[ > ]]> 0 AND t.handle_code!=200)
t.trigger_code NOT IN (0, 200) ||
t.handle_code NOT IN (0, 200)
)
</if>
<if test="logStatus == 3" >
AND (t.trigger_code = 200 AND t.handle_code=0)
AND t.trigger_code = 200
AND t.handle_code = 0
</if>
</trim>
ORDER BY id DESC
@ -78,7 +79,7 @@
SELECT count(1)
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="jobGroup != null and jobGroup != ''">
<if test="jobGroup gt 0">
AND t.job_group = #{jobGroup}
</if>
<if test="jobId gt 0">
@ -95,12 +96,13 @@
</if>
<if test="logStatus == 2" >
AND (
(t.trigger_code <![CDATA[ > ]]> 0 AND t.trigger_code!=200) ||
(t.handle_code <![CDATA[ > ]]> 0 AND t.handle_code!=200)
t.trigger_code NOT IN (0, 200) ||
t.handle_code NOT IN (0, 200)
)
</if>
<if test="logStatus == 3" >
AND (t.trigger_code = 200 AND t.handle_code=0)
AND t.trigger_code = 200
AND t.handle_code = 0
</if>
</trim>
</select>

@ -66,7 +66,7 @@ public class ScriptJobHandler extends IJobHandler {
if (exitValue == 0) {
return IJobHandler.SUCCESS;
} else if (exitValue == 501) {
} else if (exitValue == 101) {
return IJobHandler.FAIL_RETRY;
} else {
return new ReturnT<String>(IJobHandler.FAIL.getCode(), "script exit value("+exitValue+") is failed");

Loading…
Cancel
Save