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 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.JobTaskBatchStatusEnum;
|
||||
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.timer.JobTimerWheel;
|
||||
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.JobTaskBatchMapper;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.Job;
|
||||
@ -61,8 +61,6 @@ public class JobExecutorActor extends AbstractActor {
|
||||
private JobTaskBatchMapper jobTaskBatchMapper;
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Override
|
||||
public Receive createReceive() {
|
||||
@ -79,7 +77,7 @@ public class JobExecutorActor extends AbstractActor {
|
||||
} catch (Exception e) {
|
||||
LogUtils.error(log, "job executor exception. [{}]", taskExecute, e);
|
||||
handlerTaskBatch(taskExecute, JobTaskBatchStatusEnum.FAIL.getStatus(), JobOperationReasonEnum.TASK_EXECUTE_ERROR.getReason());
|
||||
context.publishEvent(new JobTaskFailAlarmEvent(taskExecute.getTaskBatchId()));
|
||||
SpringContext.CONTEXT.publishEvent(new JobTaskFailAlarmEvent(taskExecute.getTaskBatchId()));
|
||||
} finally {
|
||||
getContext().stop(getSelf());
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
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.JobTaskBatchStatusEnum;
|
||||
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.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.server.job.task.support.event.JobTaskFailAlarmEvent;
|
||||
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.po.JobTask;
|
||||
@ -51,7 +49,7 @@ public class JobTaskBatchHandler {
|
||||
new LambdaUpdateWrapper<JobTaskBatch>()
|
||||
.eq(JobTaskBatch::getId, taskBatchId)
|
||||
.in(JobTaskBatch::getTaskBatchStatus, JobTaskStatusEnum.NOT_COMPLETE));
|
||||
|
||||
SpringContext.CONTEXT.publishEvent(new JobTaskFailAlarmEvent(taskBatchId));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -67,6 +65,7 @@ public class JobTaskBatchHandler {
|
||||
|
||||
if (failCount > 0) {
|
||||
jobTaskBatch.setTaskBatchStatus(JobTaskBatchStatusEnum.FAIL.getStatus());
|
||||
SpringContext.CONTEXT.publishEvent(new JobTaskFailAlarmEvent(taskBatchId));
|
||||
} else if (stopCount > 0) {
|
||||
jobTaskBatch.setTaskBatchStatus(JobTaskBatchStatusEnum.STOP.getStatus());
|
||||
} else {
|
||||
|
@ -109,8 +109,8 @@ public abstract class AbstractScanGroup extends AbstractActor {
|
||||
return false;
|
||||
}, lastId);
|
||||
|
||||
log.warn(this.getClass().getName() + " retry scan end. groupName:[{}] startId:[{}] preCostTime:[{}] total:[{}] realPullCount:[{}]",
|
||||
groupName, lastId, preCostTime().get(), total, count.get());
|
||||
// log.warn(this.getClass().getName() + " retry scan end. groupName:[{}] startId:[{}] preCostTime:[{}] total:[{}] realPullCount:[{}]",
|
||||
// groupName, lastId, preCostTime().get(), total, count.get());
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
import request from '@/utils/request'
|
||||
import retryApi from "@/api/retryApi";
|
||||
const jobApi = {
|
||||
// 任务信息
|
||||
jobPageList: '/job/page/list',
|
||||
@ -24,7 +23,6 @@ const jobApi = {
|
||||
saveJobNotify: '/job/notify/config/',
|
||||
updateJobNotify: '/job/notify/config/',
|
||||
|
||||
|
||||
// 任务
|
||||
jobTaskList: '/job/task/list',
|
||||
|
||||
|
@ -171,7 +171,8 @@ const enums = {
|
||||
'name': '飞书',
|
||||
'color': '#087da1'
|
||||
}
|
||||
}, notifyStatus: {
|
||||
},
|
||||
notifyStatus: {
|
||||
'0': {
|
||||
'name': '停用',
|
||||
'color': '#9c1f1f'
|
||||
@ -180,7 +181,8 @@ const enums = {
|
||||
'name': '启用',
|
||||
'color': '#f5a22d'
|
||||
}
|
||||
}, rateLimiterStatus: {
|
||||
},
|
||||
rateLimiterStatus: {
|
||||
'0': {
|
||||
'name': '未启用',
|
||||
'color': '#9c1f1f'
|
||||
@ -189,7 +191,7 @@ const enums = {
|
||||
'name': '启用',
|
||||
'color': '#f5a22d'
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = enums
|
||||
|
@ -99,9 +99,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getAllGroupNameList, getSceneList} from '@/api/manage'
|
||||
import { getAllGroupNameList } from '@/api/manage'
|
||||
import { STable } from '@/components'
|
||||
import {getJobList, jobNameList, jobNotifyConfigPageList} from "@/api/jobApi";
|
||||
import { getJobList, jobNameList, jobNotifyConfigPageList } from '@/api/jobApi'
|
||||
const enums = require('@/utils/retryEnum')
|
||||
|
||||
export default {
|
||||
@ -202,7 +202,7 @@ export default {
|
||||
key: '',
|
||||
notifyTypeValue: '1',
|
||||
groupNameList: [],
|
||||
jobNameList: [],
|
||||
jobNameList: []
|
||||
}
|
||||
},
|
||||
created () {
|
||||
@ -239,7 +239,7 @@ export default {
|
||||
},
|
||||
handleEdit (record) {
|
||||
this.$router.push({ path: '/job/notify/config', query: { id: record.id } })
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -274,12 +274,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAllGroupNameList, getSceneList } from '@/api/manage'
|
||||
import { getNotifyConfigDetail, saveNotify, updateNotify } from '@/api/retryApi'
|
||||
import { getAllGroupNameList } from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import CronModal from '@/views/job/form/CronModal'
|
||||
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')
|
||||
export default {
|
||||
name: 'NotifyFrom',
|
||||
|
Loading…
Reference in New Issue
Block a user