feat: 3.1.0
1. 优化工作流重试逻辑
This commit is contained in:
parent
e95174085b
commit
9baba9ee8b
@ -71,6 +71,8 @@ public abstract class AbstractClientCallbackHandler implements ClientCallbackHan
|
|||||||
updateJobTask.setClientInfo(newClient);
|
updateJobTask.setClientInfo(newClient);
|
||||||
// 覆盖老的的客户端信息
|
// 覆盖老的的客户端信息
|
||||||
context.setClientInfo(newClient);
|
context.setClientInfo(newClient);
|
||||||
|
} else {
|
||||||
|
context.setClientInfo(context.getJobTask().getClientInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
Job job = context.getJob();
|
Job job = context.getJob();
|
||||||
@ -83,6 +85,14 @@ public abstract class AbstractClientCallbackHandler implements ClientCallbackHan
|
|||||||
|
|
||||||
private boolean isNeedRetry(ClientCallbackContext context) {
|
private boolean isNeedRetry(ClientCallbackContext context) {
|
||||||
|
|
||||||
|
JobTask jobTask = jobTaskMapper.selectById(context.getTaskId());
|
||||||
|
Job job = jobMapper.selectById(context.getJobId());
|
||||||
|
context.setJob(job);
|
||||||
|
context.setJobTask(jobTask);
|
||||||
|
if (Objects.isNull(jobTask) || Objects.isNull(job)) {
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// 手动重试策略
|
// 手动重试策略
|
||||||
if (Objects.nonNull(context.getRetryScene())
|
if (Objects.nonNull(context.getRetryScene())
|
||||||
&& Objects.equals(JobRetrySceneEnum.MANUAL.getRetryScene(), context.getRetryScene())
|
&& Objects.equals(JobRetrySceneEnum.MANUAL.getRetryScene(), context.getRetryScene())
|
||||||
@ -91,17 +101,7 @@ public abstract class AbstractClientCallbackHandler implements ClientCallbackHan
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (context.getTaskStatus().equals(JobTaskStatusEnum.FAIL.getStatus())) {
|
if (context.getTaskStatus().equals(JobTaskStatusEnum.FAIL.getStatus())) {
|
||||||
|
|
||||||
JobTask jobTask = jobTaskMapper.selectById(context.getTaskId());
|
|
||||||
Job job = jobMapper.selectById(context.getJobId());
|
|
||||||
if (Objects.isNull(jobTask) || Objects.isNull(job)) {
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jobTask.getRetryCount() < job.getMaxRetryTimes()) {
|
if (jobTask.getRetryCount() < job.getMaxRetryTimes()) {
|
||||||
context.setClientInfo(jobTask.getClientInfo());
|
|
||||||
context.setJob(job);
|
|
||||||
context.setJobTask(jobTask);
|
|
||||||
context.setRetryScene(JobRetrySceneEnum.AUTO.getRetryScene());
|
context.setRetryScene(JobRetrySceneEnum.AUTO.getRetryScene());
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,8 @@ public class JobHandler {
|
|||||||
public Boolean retry(Long taskBatchId) {
|
public Boolean retry(Long taskBatchId) {
|
||||||
return retry(taskBatchId, null, null);
|
return retry(taskBatchId, null, null);
|
||||||
}
|
}
|
||||||
public Boolean retry (Long taskBatchId, Long workflowNodeId, Long workflowTaskBatchId) {
|
|
||||||
|
public Boolean retry(Long taskBatchId, Long workflowNodeId, Long workflowTaskBatchId) {
|
||||||
JobTaskBatch jobTaskBatch = jobTaskBatchMapper.selectOne(new LambdaQueryWrapper<JobTaskBatch>()
|
JobTaskBatch jobTaskBatch = jobTaskBatchMapper.selectOne(new LambdaQueryWrapper<JobTaskBatch>()
|
||||||
.eq(JobTaskBatch::getId, taskBatchId)
|
.eq(JobTaskBatch::getId, taskBatchId)
|
||||||
.in(JobTaskBatch::getTaskBatchStatus, JobTaskBatchStatusEnum.NOT_SUCCESS)
|
.in(JobTaskBatch::getTaskBatchStatus, JobTaskBatchStatusEnum.NOT_SUCCESS)
|
||||||
@ -65,7 +66,9 @@ public class JobHandler {
|
|||||||
Job job = jobMapper.selectById(jobTaskBatch.getJobId());
|
Job job = jobMapper.selectById(jobTaskBatch.getJobId());
|
||||||
Assert.notNull(job, () -> new EasyRetryServerException("job can not be null."));
|
Assert.notNull(job, () -> new EasyRetryServerException("job can not be null."));
|
||||||
|
|
||||||
List<JobTask> jobTasks = jobTaskMapper.selectList(new LambdaQueryWrapper<JobTask>()
|
List<JobTask> jobTasks = jobTaskMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<JobTask>()
|
||||||
|
.select(JobTask::getId, JobTask::getTaskStatus)
|
||||||
.eq(JobTask::getTaskBatchId, taskBatchId));
|
.eq(JobTask::getTaskBatchId, taskBatchId));
|
||||||
|
|
||||||
// 若任务项为空则生成
|
// 若任务项为空则生成
|
||||||
@ -106,7 +109,7 @@ public class JobHandler {
|
|||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean stop (Long taskBatchId) {
|
public Boolean stop(Long taskBatchId) {
|
||||||
|
|
||||||
JobTaskBatch jobTaskBatch = jobTaskBatchMapper.selectById(taskBatchId);
|
JobTaskBatch jobTaskBatch = jobTaskBatchMapper.selectById(taskBatchId);
|
||||||
Assert.notNull(jobTaskBatch, () -> new EasyRetryServerException("job batch can not be null."));
|
Assert.notNull(jobTaskBatch, () -> new EasyRetryServerException("job batch can not be null."));
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,8 +5,8 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Easy Retry</title>
|
<title>Easy Retry</title>
|
||||||
<script type="module" crossorigin src="./assets/fjGXFx1T.js"></script>
|
<script type="module" crossorigin src="./assets/9sLx2M6c.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="./assets/RihNDpOw.css">
|
<link rel="stylesheet" crossorigin href="./assets/n6fbhMQt.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -21,8 +21,8 @@ const jobApi = {
|
|||||||
// 通知
|
// 通知
|
||||||
jobNotifyConfigPageList: '/job/notify/config/page/list',
|
jobNotifyConfigPageList: '/job/notify/config/page/list',
|
||||||
jobNotifyConfigDetail: '/job/notify/config/',
|
jobNotifyConfigDetail: '/job/notify/config/',
|
||||||
saveJobNotify: '/job/notify/config/',
|
saveJobNotify: '/job/notify/config',
|
||||||
updateJobNotify: '/job/notify/config/',
|
updateJobNotify: '/job/notify/config',
|
||||||
|
|
||||||
// 任务
|
// 任务
|
||||||
jobTaskList: '/job/task/list',
|
jobTaskList: '/job/task/list',
|
||||||
|
@ -71,8 +71,6 @@
|
|||||||
:rowKey="(record) => record.id"
|
:rowKey="(record) => record.id"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="loadData"
|
:data="loadData"
|
||||||
:alert="options.alert"
|
|
||||||
:rowSelection="options.rowSelection"
|
|
||||||
:scroll="{ x: 1500 }"
|
:scroll="{ x: 1500 }"
|
||||||
>
|
>
|
||||||
<span slot="serial" slot-scope="record">
|
<span slot="serial" slot-scope="record">
|
||||||
@ -279,7 +277,7 @@ export default {
|
|||||||
if (status === 0) {
|
if (status === 0) {
|
||||||
this.$message.error('停止失败')
|
this.$message.error('停止失败')
|
||||||
} else {
|
} else {
|
||||||
this.$refs.table.refresh(true)
|
this.$refs.table.refresh(false)
|
||||||
this.$message.success('停止成功')
|
this.$message.success('停止成功')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -290,7 +288,7 @@ export default {
|
|||||||
if (status === 0) {
|
if (status === 0) {
|
||||||
this.$message.error('重试失败')
|
this.$message.error('重试失败')
|
||||||
} else {
|
} else {
|
||||||
this.$refs.table.refresh(true)
|
this.$refs.table.refresh(false)
|
||||||
this.$message.success('重试成功')
|
this.$message.success('重试成功')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -62,10 +62,10 @@
|
|||||||
:rowKey="(record) => record.id"
|
:rowKey="(record) => record.id"
|
||||||
:columns="notifyColumns"
|
:columns="notifyColumns"
|
||||||
:data="loadData"
|
:data="loadData"
|
||||||
:alert="options.alert"
|
|
||||||
:rowSelection="options.rowSelection"
|
|
||||||
>
|
>
|
||||||
|
<span slot="serial" slot-scope="record">
|
||||||
|
{{ record.id }}
|
||||||
|
</span>
|
||||||
<span slot="notifyType" slot-scope="text">
|
<span slot="notifyType" slot-scope="text">
|
||||||
<a-tag :color="notifyTypeList[text].color">
|
<a-tag :color="notifyTypeList[text].color">
|
||||||
{{ notifyTypeList[text].name }}
|
{{ notifyTypeList[text].name }}
|
||||||
@ -110,6 +110,11 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
notifyColumns: [
|
notifyColumns: [
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
scopedSlots: { customRender: 'serial' },
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '组名',
|
title: '组名',
|
||||||
dataIndex: 'groupName',
|
dataIndex: 'groupName',
|
||||||
|
@ -70,8 +70,6 @@
|
|||||||
:rowKey="(record) => record.id"
|
:rowKey="(record) => record.id"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="loadData"
|
:data="loadData"
|
||||||
:alert="options.alert"
|
|
||||||
:rowSelection="options.rowSelection"
|
|
||||||
:scroll="{ x: 1500 }"
|
:scroll="{ x: 1500 }"
|
||||||
>
|
>
|
||||||
<span slot="serial" slot-scope="record">
|
<span slot="serial" slot-scope="record">
|
||||||
|
@ -45,8 +45,6 @@
|
|||||||
:rowKey="(record) => record.id"
|
:rowKey="(record) => record.id"
|
||||||
:columns="notifyColumns"
|
:columns="notifyColumns"
|
||||||
:data="loadData"
|
:data="loadData"
|
||||||
:alert="options.alert"
|
|
||||||
:rowSelection="options.rowSelection"
|
|
||||||
>
|
>
|
||||||
<span slot="notifyType" slot-scope="text">
|
<span slot="notifyType" slot-scope="text">
|
||||||
<a-tag :color="notifyTypeList[text].color">
|
<a-tag :color="notifyTypeList[text].color">
|
||||||
|
@ -54,8 +54,6 @@
|
|||||||
rowKey="key"
|
rowKey="key"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="loadData"
|
:data="loadData"
|
||||||
:alert="options.alert"
|
|
||||||
:rowSelection="options.rowSelection"
|
|
||||||
:scroll="{ x: 2000 }"
|
:scroll="{ x: 2000 }"
|
||||||
>
|
>
|
||||||
<span slot="uniqueId" slot-scope="text, record">
|
<span slot="uniqueId" slot-scope="text, record">
|
||||||
|
Loading…
Reference in New Issue
Block a user