|
@@ -91,7 +91,7 @@ import org.apache.dolphinscheduler.service.exceptions.CronParseException;
|
|
|
import org.apache.dolphinscheduler.service.expand.CuringParamsService;
|
|
|
import org.apache.dolphinscheduler.service.model.TaskNode;
|
|
|
import org.apache.dolphinscheduler.service.process.ProcessService;
|
|
|
-import org.apache.dolphinscheduler.service.queue.PeerTaskInstancePriorityQueue;
|
|
|
+import org.apache.dolphinscheduler.service.queue.StandByTaskInstancePriorityQueue;
|
|
|
import org.apache.dolphinscheduler.service.utils.DagHelper;
|
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
@@ -208,7 +208,8 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
/**
|
|
|
* The StandBy task list, will be executed, need to know, the taskInstance in this queue may doesn't have id.
|
|
|
*/
|
|
|
- private final PeerTaskInstancePriorityQueue readyToSubmitTaskQueue = new PeerTaskInstancePriorityQueue();
|
|
|
+ private final StandByTaskInstancePriorityQueue standByTaskInstancePriorityQueue =
|
|
|
+ new StandByTaskInstancePriorityQueue();
|
|
|
|
|
|
/**
|
|
|
* wait to retry taskInstance map, taskCode as key, taskInstance as value
|
|
@@ -249,7 +250,7 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
this.taskInstanceDao = taskInstanceDao;
|
|
|
this.defaultTaskExecuteRunnableFactory = defaultTaskExecuteRunnableFactory;
|
|
|
this.listenerEventAlertManager = listenerEventAlertManager;
|
|
|
- TaskMetrics.registerTaskPrepared(readyToSubmitTaskQueue::size);
|
|
|
+ TaskMetrics.registerTaskPrepared(standByTaskInstancePriorityQueue::size);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1430,7 +1431,7 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
// if previous node success , post node submit
|
|
|
for (TaskInstance task : taskInstances) {
|
|
|
|
|
|
- if (readyToSubmitTaskQueue.contains(task)) {
|
|
|
+ if (standByTaskInstancePriorityQueue.contains(task)) {
|
|
|
log.warn("Task is already at submit queue, taskInstanceName: {}", task.getName());
|
|
|
continue;
|
|
|
}
|
|
@@ -1665,7 +1666,7 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
return true;
|
|
|
}
|
|
|
if (workflowInstance.getFailureStrategy() == FailureStrategy.CONTINUE) {
|
|
|
- return readyToSubmitTaskQueue.size() == 0 && taskExecuteRunnableMap.size() == 0
|
|
|
+ return standByTaskInstancePriorityQueue.size() == 0 && taskExecuteRunnableMap.size() == 0
|
|
|
&& waitToRetryTaskInstanceMap.size() == 0;
|
|
|
}
|
|
|
}
|
|
@@ -1688,7 +1689,7 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
|
|
|
List<TaskInstance> pauseList = getCompleteTaskByState(TaskExecutionStatus.PAUSE);
|
|
|
if (CollectionUtils.isNotEmpty(pauseList) || workflowInstance.isBlocked() || !isComplementEnd()
|
|
|
- || readyToSubmitTaskQueue.size() > 0) {
|
|
|
+ || standByTaskInstancePriorityQueue.size() > 0) {
|
|
|
return WorkflowExecutionStatus.PAUSE;
|
|
|
} else {
|
|
|
return WorkflowExecutionStatus.SUCCESS;
|
|
@@ -1711,8 +1712,8 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (readyToSubmitTaskQueue.size() > 0) {
|
|
|
- for (Iterator<TaskInstance> iter = readyToSubmitTaskQueue.iterator(); iter.hasNext();) {
|
|
|
+ if (standByTaskInstancePriorityQueue.size() > 0) {
|
|
|
+ for (Iterator<TaskInstance> iter = standByTaskInstancePriorityQueue.iterator(); iter.hasNext();) {
|
|
|
iter.next().setState(TaskExecutionStatus.PAUSE);
|
|
|
}
|
|
|
}
|
|
@@ -1773,7 +1774,7 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
// success
|
|
|
if (state == WorkflowExecutionStatus.RUNNING_EXECUTION) {
|
|
|
List<TaskInstance> killTasks = getCompleteTaskByState(TaskExecutionStatus.KILL);
|
|
|
- if (readyToSubmitTaskQueue.size() > 0 || waitToRetryTaskInstanceMap.size() > 0) {
|
|
|
+ if (standByTaskInstancePriorityQueue.size() > 0 || waitToRetryTaskInstanceMap.size() > 0) {
|
|
|
// tasks currently pending submission, no retries, indicating that depend is waiting to complete
|
|
|
return WorkflowExecutionStatus.RUNNING_EXECUTION;
|
|
|
} else if (CollectionUtils.isNotEmpty(killTasks)) {
|
|
@@ -1878,7 +1879,7 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
* @param taskInstance task instance
|
|
|
*/
|
|
|
public void addTaskToStandByList(TaskInstance taskInstance) {
|
|
|
- if (readyToSubmitTaskQueue.contains(taskInstance)) {
|
|
|
+ if (standByTaskInstancePriorityQueue.contains(taskInstance)) {
|
|
|
log.warn("Task already exists in ready submit queue, no need to add again, task code:{}",
|
|
|
taskInstance.getTaskCode());
|
|
|
return;
|
|
@@ -1888,7 +1889,7 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
taskInstance.getId(),
|
|
|
taskInstance.getTaskCode());
|
|
|
TaskMetrics.incTaskInstanceByState("submit");
|
|
|
- readyToSubmitTaskQueue.put(taskInstance);
|
|
|
+ standByTaskInstancePriorityQueue.put(taskInstance);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1897,7 +1898,7 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
* @param taskInstance task instance
|
|
|
*/
|
|
|
private boolean removeTaskFromStandbyList(TaskInstance taskInstance) {
|
|
|
- return readyToSubmitTaskQueue.remove(taskInstance);
|
|
|
+ return standByTaskInstancePriorityQueue.remove(taskInstance);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1906,7 +1907,7 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
* @return Boolean whether has retry task in standby
|
|
|
*/
|
|
|
private boolean hasRetryTaskInStandBy() {
|
|
|
- for (Iterator<TaskInstance> iter = readyToSubmitTaskQueue.iterator(); iter.hasNext();) {
|
|
|
+ for (Iterator<TaskInstance> iter = standByTaskInstancePriorityQueue.iterator(); iter.hasNext();) {
|
|
|
if (iter.next().getState().isFailure()) {
|
|
|
return true;
|
|
|
}
|
|
@@ -1923,8 +1924,8 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
workflowInstance.getId(),
|
|
|
taskExecuteRunnableMap.size());
|
|
|
|
|
|
- if (readyToSubmitTaskQueue.size() > 0) {
|
|
|
- readyToSubmitTaskQueue.clear();
|
|
|
+ if (standByTaskInstancePriorityQueue.size() > 0) {
|
|
|
+ standByTaskInstancePriorityQueue.clear();
|
|
|
}
|
|
|
|
|
|
for (long taskCode : taskExecuteRunnableMap.keySet()) {
|
|
@@ -1965,7 +1966,7 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable {
|
|
|
public void submitStandByTask() throws StateEventHandleException {
|
|
|
ProcessInstance workflowInstance = workflowExecuteContext.getWorkflowInstance();
|
|
|
TaskInstance task;
|
|
|
- while ((task = readyToSubmitTaskQueue.peek()) != null) {
|
|
|
+ while ((task = standByTaskInstancePriorityQueue.peek()) != null) {
|
|
|
// stop tasks which is retrying if forced success happens
|
|
|
if (task.getId() != null && task.taskCanRetry()) {
|
|
|
TaskInstance retryTask = taskInstanceDao.queryById(task.getId());
|