refactor:2.5.0
1. 任务批次更新状态为失败时发生告警 2. 优化前端js格式
This commit is contained in:
parent
789ebb2a87
commit
b328aafbe7
@ -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',
|
||||
@ -18,13 +17,12 @@ const jobApi = {
|
||||
jobBatchDetail: '/job/batch/',
|
||||
stop: '/job/batch/stop/',
|
||||
|
||||
//通知
|
||||
// 通知
|
||||
jobNotifyConfigPageList: '/job/notify/config/page/list',
|
||||
jobNotifyConfigDetail: '/job/notify/config/',
|
||||
saveJobNotify: '/job/notify/config/',
|
||||
updateJobNotify: '/job/notify/config/',
|
||||
|
||||
|
||||
// 任务
|
||||
jobTaskList: '/job/task/list',
|
||||
|
||||
@ -177,4 +175,4 @@ export function updateJobNotify (data) {
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -111,7 +111,7 @@ const jobAdmin = [
|
||||
roleId: 1,
|
||||
permissionId: 'jobBatch',
|
||||
permissionName: '任务批次'
|
||||
},{
|
||||
}, {
|
||||
roleId: 1,
|
||||
permissionId: 'jobNotify',
|
||||
permissionName: '任务通知'
|
||||
|
@ -28,7 +28,7 @@
|
||||
@search="handleSearch"
|
||||
>
|
||||
<a-select-option v-for="(item, index) in jobNameList" :value="item.id" :key="index">
|
||||
{{item.jobName}}
|
||||
{{ item.jobName }}
|
||||
</a-select-option>
|
||||
|
||||
</a-select>
|
||||
@ -38,17 +38,17 @@
|
||||
|
||||
</template>
|
||||
<a-col :md="(!advanced && 8) || 24" :sm="24">
|
||||
<span
|
||||
class="table-page-search-submitButtons"
|
||||
:style="(advanced && { float: 'right', overflow: 'hidden' }) || {}"
|
||||
>
|
||||
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
||||
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
|
||||
<a @click="toggleAdvanced" style="margin-left: 8px">
|
||||
{{ advanced ? '收起' : '展开' }}
|
||||
<a-icon :type="advanced ? 'up' : 'down'" />
|
||||
</a>
|
||||
</span>
|
||||
<span
|
||||
class="table-page-search-submitButtons"
|
||||
:style="(advanced && { float: 'right', overflow: 'hidden' }) || {}"
|
||||
>
|
||||
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
||||
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
|
||||
<a @click="toggleAdvanced" style="margin-left: 8px">
|
||||
{{ advanced ? '收起' : '展开' }}
|
||||
<a-icon :type="advanced ? 'up' : 'down'" />
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
@ -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>
|
||||
|
@ -56,15 +56,15 @@
|
||||
<a-row class="form-row" :gutter="16">
|
||||
<a-col :lg="18" :md="12" :sm="24">
|
||||
<a-form-item label="组">
|
||||
<a-select placeholder="请选择组" v-decorator="['groupName', { rules: [{ required: true, message: '请选择组' }] }]" @change="value => changeGroup(value)">
|
||||
<a-select placeholder="请选择组" v-decorator="['groupName', { rules: [{ required: true, message: '请选择组' }] }]" @change="value => changeGroup(value)">
|
||||
<a-select-option v-for="item in groupNameList" :value="item" :key="item">{{ item }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6" :md="12" :sm="24">
|
||||
<a-form-item label="任务">
|
||||
<a-select :disabled="sceneNameDisabled.includes(this.notifySceneValue)" placeholder="请选择任务" v-decorator="['jobId', { rules: [{ required: true, message: '请选择任务' }] }]" >
|
||||
<a-select-option v-for="item in jobList" :value="item.id" :key="item.id">{{item.jobName}}</a-select-option>
|
||||
<a-select :disabled="sceneNameDisabled.includes(this.notifySceneValue)" placeholder="请选择任务" v-decorator="['jobId', { rules: [{ required: true, message: '请选择任务' }] }]" >
|
||||
<a-select-option v-for="item in jobList" :value="item.id" :key="item.id">{{ item.jobName }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@ -103,21 +103,21 @@
|
||||
<a-row class="form-row" :gutter="16">
|
||||
<a-col :lg="8" :md="12" :sm="24">
|
||||
<a-form-item label="限流状态">
|
||||
<a-select :disabled="rateLimiterStatusDisabled.includes(this.notifySceneValue)" placeholder="请选择限流状态" @change="changeRateLimiterStatus" v-decorator="['rateLimiterStatus',{initialValue: '0', rules: [{ required: true, message: '请选择限流状态'}]}]" >
|
||||
<a-select :disabled="rateLimiterStatusDisabled.includes(this.notifySceneValue)" placeholder="请选择限流状态" @change="changeRateLimiterStatus" v-decorator="['rateLimiterStatus',{initialValue: '0', rules: [{ required: true, message: '请选择限流状态'}]}]" >
|
||||
<a-select-option :value="index" v-for="(item, index) in rateLimiterStatusList" :key="index">{{ item.name }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="8" :md="12" :sm="24">
|
||||
<a-form-item label="每秒限流阈值">
|
||||
<a-input-number :disabled="rateLimiterThresholdDisabled.includes(this.rateLimiterStatusValue)" id="inputNumber" :min="1" style="width: -webkit-fill-available" v-decorator= "['rateLimiterThreshold',{initialValue: '100',rules: [{ required: !rateLimiterThresholdDisabled.includes(this.rateLimiterStatusValue), message: '请输入通知阈值' }]}]" />
|
||||
</a-form-item>
|
||||
<a-input-number :disabled="rateLimiterThresholdDisabled.includes(this.rateLimiterStatusValue)" id="inputNumber" :min="1" style="width: -webkit-fill-available" v-decorator="['rateLimiterThreshold',{initialValue: '100',rules: [{ required: !rateLimiterThresholdDisabled.includes(this.rateLimiterStatusValue), message: '请输入通知阈值' }]}]" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="8" :md="12" :sm="24">
|
||||
<a-form-item label="状态">
|
||||
<a-select
|
||||
placeholder="请选择状态"
|
||||
v-decorator="[
|
||||
placeholder="请选择状态"
|
||||
v-decorator="[
|
||||
'notifyStatus',
|
||||
{
|
||||
initialValue: '1',
|
||||
@ -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