Browse Source

[Improvement-16487][Master] Improve the dependent result for workflow dependency tasks (#16488)

dev
veli.yang 3 months ago committed by GitHub
parent
commit
10295d322a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 17
      dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/DependentExecute.java

17
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/DependentExecute.java

@ -284,7 +284,7 @@ public class DependentExecute {
addItemVarPool(taskInstance.getVarPool(), taskInstance.getEndTime().getTime()); addItemVarPool(taskInstance.getVarPool(), taskInstance.getEndTime().getTime());
return DependResult.SUCCESS; return DependResult.SUCCESS;
} }
return getDependResultByState(taskInstance.getState()); return getDependResultOfTask(processInstance, taskInstance);
} }
} }
@ -337,18 +337,27 @@ public class DependentExecute {
} }
/** /**
* get dependent result by task/process instance state * get dependent result by task/process instance
* *
* @param state state * @param processInstance process instance
* @param taskInstance task instance
* @return DependResult * @return DependResult
*/ */
private DependResult getDependResultByState(TaskExecutionStatus state) { private DependResult getDependResultOfTask(ProcessInstance processInstance, TaskInstance taskInstance) {
TaskExecutionStatus state = taskInstance.getState();
if (!state.isFinished()) { if (!state.isFinished()) {
return DependResult.WAITING; return DependResult.WAITING;
} else if (state.isSuccess()) { } else if (state.isSuccess()) {
return DependResult.SUCCESS; return DependResult.SUCCESS;
} else { } else {
if (processInstance.getState().isRunning()
&& taskInstance.getRetryTimes() < taskInstance.getMaxRetryTimes()) {
log.info("taskDefinitionCode: {}, taskDefinitionName: {}, retryTimes: {}, maxRetryTimes: {}",
taskInstance.getTaskCode(), taskInstance.getName(), taskInstance.getRetryTimes(),
taskInstance.getMaxRetryTimes());
return DependResult.WAITING;
}
log.warn( log.warn(
"The dependent task were not executed successfully, so return depend failed. Task code: {}, task name: {}.", "The dependent task were not executed successfully, so return depend failed. Task code: {}, task name: {}.",
taskInstance.getTaskCode(), taskInstance.getName()); taskInstance.getTaskCode(), taskInstance.getName());

Loading…
Cancel
Save