refactor:2.5.0
1. 任务批次更新状态为失败时发生告警 2. 优化前端js格式
This commit is contained in:
parent
4d0dc2b213
commit
8da0d1b993
@ -2,6 +2,7 @@ package com.aizuda.easy.retry.server.job.task.support.dispatch;
|
|||||||
|
|
||||||
import akka.actor.AbstractActor;
|
import akka.actor.AbstractActor;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.aizuda.easy.retry.common.core.context.SpringContext;
|
||||||
import com.aizuda.easy.retry.common.core.enums.JobOperationReasonEnum;
|
import com.aizuda.easy.retry.common.core.enums.JobOperationReasonEnum;
|
||||||
import com.aizuda.easy.retry.common.core.enums.JobTaskBatchStatusEnum;
|
import com.aizuda.easy.retry.common.core.enums.JobTaskBatchStatusEnum;
|
||||||
import com.aizuda.easy.retry.common.core.enums.StatusEnum;
|
import com.aizuda.easy.retry.common.core.enums.StatusEnum;
|
||||||
@ -23,7 +24,6 @@ import com.aizuda.easy.retry.server.job.task.support.executor.JobExecutorContext
|
|||||||
import com.aizuda.easy.retry.server.job.task.support.executor.JobExecutorFactory;
|
import com.aizuda.easy.retry.server.job.task.support.executor.JobExecutorFactory;
|
||||||
import com.aizuda.easy.retry.server.job.task.support.timer.JobTimerWheel;
|
import com.aizuda.easy.retry.server.job.task.support.timer.JobTimerWheel;
|
||||||
import com.aizuda.easy.retry.server.job.task.support.timer.ResidentJobTimerTask;
|
import com.aizuda.easy.retry.server.job.task.support.timer.ResidentJobTimerTask;
|
||||||
import com.aizuda.easy.retry.server.retry.task.support.event.RetryTaskFailMoreThresholdAlarmEvent;
|
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobMapper;
|
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobMapper;
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobTaskBatchMapper;
|
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobTaskBatchMapper;
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.po.Job;
|
import com.aizuda.easy.retry.template.datasource.persistence.po.Job;
|
||||||
@ -61,8 +61,6 @@ public class JobExecutorActor extends AbstractActor {
|
|||||||
private JobTaskBatchMapper jobTaskBatchMapper;
|
private JobTaskBatchMapper jobTaskBatchMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TransactionTemplate transactionTemplate;
|
private TransactionTemplate transactionTemplate;
|
||||||
@Autowired
|
|
||||||
private ApplicationContext context;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Receive createReceive() {
|
public Receive createReceive() {
|
||||||
@ -79,7 +77,7 @@ public class JobExecutorActor extends AbstractActor {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.error(log, "job executor exception. [{}]", taskExecute, e);
|
LogUtils.error(log, "job executor exception. [{}]", taskExecute, e);
|
||||||
handlerTaskBatch(taskExecute, JobTaskBatchStatusEnum.FAIL.getStatus(), JobOperationReasonEnum.TASK_EXECUTE_ERROR.getReason());
|
handlerTaskBatch(taskExecute, JobTaskBatchStatusEnum.FAIL.getStatus(), JobOperationReasonEnum.TASK_EXECUTE_ERROR.getReason());
|
||||||
context.publishEvent(new JobTaskFailAlarmEvent(taskExecute.getTaskBatchId()));
|
SpringContext.CONTEXT.publishEvent(new JobTaskFailAlarmEvent(taskExecute.getTaskBatchId()));
|
||||||
} finally {
|
} finally {
|
||||||
getContext().stop(getSelf());
|
getContext().stop(getSelf());
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package com.aizuda.easy.retry.server.job.task.support.handler;
|
package com.aizuda.easy.retry.server.job.task.support.handler;
|
||||||
|
|
||||||
|
import com.aizuda.easy.retry.common.core.context.SpringContext;
|
||||||
import com.aizuda.easy.retry.common.core.enums.JobOperationReasonEnum;
|
import com.aizuda.easy.retry.common.core.enums.JobOperationReasonEnum;
|
||||||
import com.aizuda.easy.retry.common.core.enums.JobTaskBatchStatusEnum;
|
import com.aizuda.easy.retry.common.core.enums.JobTaskBatchStatusEnum;
|
||||||
import com.aizuda.easy.retry.common.core.enums.JobTaskStatusEnum;
|
import com.aizuda.easy.retry.common.core.enums.JobTaskStatusEnum;
|
||||||
import com.aizuda.easy.retry.server.job.task.support.JobTaskConverter;
|
import com.aizuda.easy.retry.server.job.task.support.event.JobTaskFailAlarmEvent;
|
||||||
import com.aizuda.easy.retry.server.job.task.support.JobTaskStopHandler;
|
|
||||||
import com.aizuda.easy.retry.server.job.task.support.stop.JobTaskStopFactory;
|
|
||||||
import com.aizuda.easy.retry.server.job.task.support.stop.TaskStopJobContext;
|
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobTaskBatchMapper;
|
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobTaskBatchMapper;
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobTaskMapper;
|
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobTaskMapper;
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.po.JobTask;
|
import com.aizuda.easy.retry.template.datasource.persistence.po.JobTask;
|
||||||
@ -51,7 +49,7 @@ public class JobTaskBatchHandler {
|
|||||||
new LambdaUpdateWrapper<JobTaskBatch>()
|
new LambdaUpdateWrapper<JobTaskBatch>()
|
||||||
.eq(JobTaskBatch::getId, taskBatchId)
|
.eq(JobTaskBatch::getId, taskBatchId)
|
||||||
.in(JobTaskBatch::getTaskBatchStatus, JobTaskStatusEnum.NOT_COMPLETE));
|
.in(JobTaskBatch::getTaskBatchStatus, JobTaskStatusEnum.NOT_COMPLETE));
|
||||||
|
SpringContext.CONTEXT.publishEvent(new JobTaskFailAlarmEvent(taskBatchId));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +65,7 @@ public class JobTaskBatchHandler {
|
|||||||
|
|
||||||
if (failCount > 0) {
|
if (failCount > 0) {
|
||||||
jobTaskBatch.setTaskBatchStatus(JobTaskBatchStatusEnum.FAIL.getStatus());
|
jobTaskBatch.setTaskBatchStatus(JobTaskBatchStatusEnum.FAIL.getStatus());
|
||||||
|
SpringContext.CONTEXT.publishEvent(new JobTaskFailAlarmEvent(taskBatchId));
|
||||||
} else if (stopCount > 0) {
|
} else if (stopCount > 0) {
|
||||||
jobTaskBatch.setTaskBatchStatus(JobTaskBatchStatusEnum.STOP.getStatus());
|
jobTaskBatch.setTaskBatchStatus(JobTaskBatchStatusEnum.STOP.getStatus());
|
||||||
} else {
|
} else {
|
||||||
|
@ -109,8 +109,8 @@ public abstract class AbstractScanGroup extends AbstractActor {
|
|||||||
return false;
|
return false;
|
||||||
}, lastId);
|
}, lastId);
|
||||||
|
|
||||||
log.warn(this.getClass().getName() + " retry scan end. groupName:[{}] startId:[{}] preCostTime:[{}] total:[{}] realPullCount:[{}]",
|
// log.warn(this.getClass().getName() + " retry scan end. groupName:[{}] startId:[{}] preCostTime:[{}] total:[{}] realPullCount:[{}]",
|
||||||
groupName, lastId, preCostTime().get(), total, count.get());
|
// groupName, lastId, preCostTime().get(), total, count.get());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
import retryApi from "@/api/retryApi";
|
|
||||||
const jobApi = {
|
const jobApi = {
|
||||||
// 任务信息
|
// 任务信息
|
||||||
jobPageList: '/job/page/list',
|
jobPageList: '/job/page/list',
|
||||||
@ -24,7 +23,6 @@ const jobApi = {
|
|||||||
saveJobNotify: '/job/notify/config/',
|
saveJobNotify: '/job/notify/config/',
|
||||||
updateJobNotify: '/job/notify/config/',
|
updateJobNotify: '/job/notify/config/',
|
||||||
|
|
||||||
|
|
||||||
// 任务
|
// 任务
|
||||||
jobTaskList: '/job/task/list',
|
jobTaskList: '/job/task/list',
|
||||||
|
|
||||||
|
@ -171,7 +171,8 @@ const enums = {
|
|||||||
'name': '飞书',
|
'name': '飞书',
|
||||||
'color': '#087da1'
|
'color': '#087da1'
|
||||||
}
|
}
|
||||||
}, notifyStatus: {
|
},
|
||||||
|
notifyStatus: {
|
||||||
'0': {
|
'0': {
|
||||||
'name': '停用',
|
'name': '停用',
|
||||||
'color': '#9c1f1f'
|
'color': '#9c1f1f'
|
||||||
@ -180,7 +181,8 @@ const enums = {
|
|||||||
'name': '启用',
|
'name': '启用',
|
||||||
'color': '#f5a22d'
|
'color': '#f5a22d'
|
||||||
}
|
}
|
||||||
}, rateLimiterStatus: {
|
},
|
||||||
|
rateLimiterStatus: {
|
||||||
'0': {
|
'0': {
|
||||||
'name': '未启用',
|
'name': '未启用',
|
||||||
'color': '#9c1f1f'
|
'color': '#9c1f1f'
|
||||||
@ -189,7 +191,7 @@ const enums = {
|
|||||||
'name': '启用',
|
'name': '启用',
|
||||||
'color': '#f5a22d'
|
'color': '#f5a22d'
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = enums
|
module.exports = enums
|
||||||
|
@ -99,9 +99,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getAllGroupNameList, getSceneList} from '@/api/manage'
|
import { getAllGroupNameList } from '@/api/manage'
|
||||||
import { STable } from '@/components'
|
import { STable } from '@/components'
|
||||||
import {getJobList, jobNameList, jobNotifyConfigPageList} from "@/api/jobApi";
|
import { getJobList, jobNameList, jobNotifyConfigPageList } from '@/api/jobApi'
|
||||||
const enums = require('@/utils/retryEnum')
|
const enums = require('@/utils/retryEnum')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -202,7 +202,7 @@ export default {
|
|||||||
key: '',
|
key: '',
|
||||||
notifyTypeValue: '1',
|
notifyTypeValue: '1',
|
||||||
groupNameList: [],
|
groupNameList: [],
|
||||||
jobNameList: [],
|
jobNameList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
@ -239,7 +239,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleEdit (record) {
|
handleEdit (record) {
|
||||||
this.$router.push({ path: '/job/notify/config', query: { id: record.id } })
|
this.$router.push({ path: '/job/notify/config', query: { id: record.id } })
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -274,12 +274,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getAllGroupNameList, getSceneList } from '@/api/manage'
|
import { getAllGroupNameList } from '@/api/manage'
|
||||||
import { getNotifyConfigDetail, saveNotify, updateNotify } from '@/api/retryApi'
|
|
||||||
import pick from 'lodash.pick'
|
import pick from 'lodash.pick'
|
||||||
import CronModal from '@/views/job/form/CronModal'
|
import CronModal from '@/views/job/form/CronModal'
|
||||||
import { officialWebsite } from '@/utils/util'
|
import { officialWebsite } from '@/utils/util'
|
||||||
import {getJobList, getJobNotifyConfigDetail, saveJobNotify, updateJobNotify} from "@/api/jobApi";
|
import { getJobList, getJobNotifyConfigDetail, saveJobNotify, updateJobNotify } from '@/api/jobApi'
|
||||||
const enums = require('@/utils/jobEnum')
|
const enums = require('@/utils/jobEnum')
|
||||||
export default {
|
export default {
|
||||||
name: 'NotifyFrom',
|
name: 'NotifyFrom',
|
||||||
|
Loading…
Reference in New Issue
Block a user