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 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',
|
||||||
@ -18,13 +17,12 @@ const jobApi = {
|
|||||||
jobBatchDetail: '/job/batch/',
|
jobBatchDetail: '/job/batch/',
|
||||||
stop: '/job/batch/stop/',
|
stop: '/job/batch/stop/',
|
||||||
|
|
||||||
//通知
|
// 通知
|
||||||
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',
|
||||||
|
|
||||||
@ -177,4 +175,4 @@ export function updateJobNotify (data) {
|
|||||||
method: 'put',
|
method: 'put',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -111,7 +111,7 @@ const jobAdmin = [
|
|||||||
roleId: 1,
|
roleId: 1,
|
||||||
permissionId: 'jobBatch',
|
permissionId: 'jobBatch',
|
||||||
permissionName: '任务批次'
|
permissionName: '任务批次'
|
||||||
},{
|
}, {
|
||||||
roleId: 1,
|
roleId: 1,
|
||||||
permissionId: 'jobNotify',
|
permissionId: 'jobNotify',
|
||||||
permissionName: '任务通知'
|
permissionName: '任务通知'
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
@search="handleSearch"
|
@search="handleSearch"
|
||||||
>
|
>
|
||||||
<a-select-option v-for="(item, index) in jobNameList" :value="item.id" :key="index">
|
<a-select-option v-for="(item, index) in jobNameList" :value="item.id" :key="index">
|
||||||
{{item.jobName}}
|
{{ item.jobName }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
|
|
||||||
</a-select>
|
</a-select>
|
||||||
@ -38,17 +38,17 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
<a-col :md="(!advanced && 8) || 24" :sm="24">
|
<a-col :md="(!advanced && 8) || 24" :sm="24">
|
||||||
<span
|
<span
|
||||||
class="table-page-search-submitButtons"
|
class="table-page-search-submitButtons"
|
||||||
:style="(advanced && { float: 'right', overflow: 'hidden' }) || {}"
|
:style="(advanced && { float: 'right', overflow: 'hidden' }) || {}"
|
||||||
>
|
>
|
||||||
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
||||||
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
|
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
|
||||||
<a @click="toggleAdvanced" style="margin-left: 8px">
|
<a @click="toggleAdvanced" style="margin-left: 8px">
|
||||||
{{ advanced ? '收起' : '展开' }}
|
{{ advanced ? '收起' : '展开' }}
|
||||||
<a-icon :type="advanced ? 'up' : 'down'" />
|
<a-icon :type="advanced ? 'up' : 'down'" />
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
@ -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>
|
||||||
|
@ -56,15 +56,15 @@
|
|||||||
<a-row class="form-row" :gutter="16">
|
<a-row class="form-row" :gutter="16">
|
||||||
<a-col :lg="18" :md="12" :sm="24">
|
<a-col :lg="18" :md="12" :sm="24">
|
||||||
<a-form-item label="组">
|
<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-option v-for="item in groupNameList" :value="item" :key="item">{{ item }}</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="6" :md="12" :sm="24">
|
<a-col :lg="6" :md="12" :sm="24">
|
||||||
<a-form-item label="任务">
|
<a-form-item label="任务">
|
||||||
<a-select :disabled="sceneNameDisabled.includes(this.notifySceneValue)" placeholder="请选择任务" v-decorator="['jobId', { rules: [{ required: true, message: '请选择任务' }] }]" >
|
<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-option v-for="item in jobList" :value="item.id" :key="item.id">{{ item.jobName }}</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
@ -103,21 +103,21 @@
|
|||||||
<a-row class="form-row" :gutter="16">
|
<a-row class="form-row" :gutter="16">
|
||||||
<a-col :lg="8" :md="12" :sm="24">
|
<a-col :lg="8" :md="12" :sm="24">
|
||||||
<a-form-item label="限流状态">
|
<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-option :value="index" v-for="(item, index) in rateLimiterStatusList" :key="index">{{ item.name }}</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="8" :md="12" :sm="24">
|
<a-col :lg="8" :md="12" :sm="24">
|
||||||
<a-form-item label="每秒限流阈值">
|
<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-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-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="8" :md="12" :sm="24">
|
<a-col :lg="8" :md="12" :sm="24">
|
||||||
<a-form-item label="状态">
|
<a-form-item label="状态">
|
||||||
<a-select
|
<a-select
|
||||||
placeholder="请选择状态"
|
placeholder="请选择状态"
|
||||||
v-decorator="[
|
v-decorator="[
|
||||||
'notifyStatus',
|
'notifyStatus',
|
||||||
{
|
{
|
||||||
initialValue: '1',
|
initialValue: '1',
|
||||||
@ -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