Skip to content

Commit

Permalink
feat: 执行引擎任务调度配额限制 TencentBlueKing#261
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu096 committed Jun 17, 2024
1 parent 3bf7f2e commit df36fcb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public JobListener(TaskExecuteMQEventDispatcher taskExecuteMQEventDispatcher,
TaskInstanceService taskInstanceService,
StepInstanceService stepInstanceService,
RollingConfigService rollingConfigService,
NotifyService notifyService, RunningJobQuoteManager runningJobQuoteManager) {
NotifyService notifyService,
RunningJobQuoteManager runningJobQuoteManager) {
this.taskExecuteMQEventDispatcher = taskExecuteMQEventDispatcher;
this.statisticsService = statisticsService;
this.taskInstanceService = taskInstanceService;
Expand Down Expand Up @@ -104,9 +105,6 @@ public void handleEvent(JobEvent jobEvent) {
case STOP:
stopJob(taskInstance);
break;
case RESTART:
restartJob(taskInstance);
break;
case REFRESH:
refreshJob(taskInstance);
break;
Expand Down Expand Up @@ -160,35 +158,6 @@ private void stopJob(TaskInstanceDTO taskInstance) {
}
}

/**
* 重头执行作业
*
* @param taskInstance 作业实例
*/
private void restartJob(TaskInstanceDTO taskInstance) {
long jobInstanceId = taskInstance.getId();
RunStatusEnum taskStatus = taskInstance.getStatus();
// 验证作业状态,只有“执行失败”和“等待用户”的作业可以重头执行
if (RunStatusEnum.WAITING_USER == taskStatus || RunStatusEnum.FAIL == taskStatus) {

// 重置作业状态
taskInstanceService.resetTaskStatus(jobInstanceId);
stepInstanceService.addStepInstanceExecuteCount(jobInstanceId);

// 重置作业下步骤的状态、开始时间和结束时间等。
List<Long> stepInstanceIdList = stepInstanceService.getTaskStepIdList(jobInstanceId);
for (long stepInstanceId : stepInstanceIdList) {
stepInstanceService.updateStepStatus(stepInstanceId, RunStatusEnum.BLANK.getValue());
stepInstanceService.resetStepStatus(stepInstanceId);
}

taskExecuteMQEventDispatcher.dispatchJobEvent(JobEvent.startJob(jobInstanceId));
} else {
log.warn("Unsupported job instance run status for restart task, jobInstanceId={}, status={}",
jobInstanceId, taskInstance.getStatus());
}
}

/**
* 作业状态流转
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ data:
job:
features:
{{- toYaml .Values.job.features | nindent 8 }}
job:
resourceScopeQuotaLimit:
limitedResources:
{{- if .Values.job.resourceScopeQuotaLimit.limitedResources }}
Expand Down

0 comments on commit df36fcb

Please sign in to comment.