Skip to content

Commit 42ba593

Browse files
brave-leezhanqian-1993北笙Hou-Shuaishuaihoushuai
authored
[Fix-10762] [bug] Dependent tasks wait for the workflow to end (#10765)
* issue 8645 (#8811) Co-authored-by: 北笙 <“[email protected]”> Co-authored-by: zhanqian <[email protected]> * [fix-8929][DAO]Description Failed to upload the file because the full name was too long (#9020) * [fix-8929][DAO]Description Failed to upload the file because the full name was too long * [DS-#8929][fix]Description Failed to upload the file because the full name was too long * [DS-#8929][fix]Description Failed to upload the file because the full name was too long * [DS-#8929][fix]Description Failed to upload the file because the full name was too long Co-authored-by: houshuai <[email protected]> * [BUG][ALERT-SERVER]validate script before alert script (#9834) * validate script before alert script * fix validate script before alert script * pick 8811/9020/9834 * fix ut * fix pick error * fix 10762 Co-authored-by: zhanqian <[email protected]> Co-authored-by: 北笙 <“[email protected]”> Co-authored-by: zhanqian <[email protected]> Co-authored-by: shuai hou <[email protected]> Co-authored-by: houshuai <[email protected]> Co-authored-by: Tq <[email protected]> Co-authored-by: JinyLeeChina <[email protected]>
1 parent 23fae51 commit 42ba593

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import java.util.HashSet;
6565
import java.util.List;
6666
import java.util.Map;
67+
import java.util.Objects;
6768
import java.util.Set;
6869
import java.util.UUID;
6970
import java.util.regex.Matcher;

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,16 @@ private DependResult calculateResultForTasks(DependentItem dependentItem, List<D
115115
dependentItem.getDefinitionCode(), dependentItem.getDepTaskCode());
116116
return DependResult.WAITING;
117117
}
118-
if (!processInstance.getState().typeIsFinished()) {
119-
logger.info("Wait for the dependent workflow to complete, processDefiniteCode:{}, taskCode:{}, processInstanceId:{}, processInstance state:{}",
120-
dependentItem.getDefinitionCode(), dependentItem.getDepTaskCode(), processInstance.getId(), processInstance.getState());
121-
return DependResult.WAITING;
122-
}
123118
// need to check workflow for updates, so get all task and check the task state
124119
if (dependentItem.getDepTaskCode() == Constants.DEPENDENT_ALL_TASK_CODE) {
120+
if (!processInstance.getState().typeIsFinished()) {
121+
logger.info("Wait for the dependent workflow to complete, processDefiniteCode:{}, taskCode:{}, processInstanceId:{}, processInstance state:{}",
122+
dependentItem.getDefinitionCode(), dependentItem.getDepTaskCode(), processInstance.getId(), processInstance.getState());
123+
return DependResult.WAITING;
124+
}
125125
result = dependResultByProcessInstance(processInstance, dateInterval);
126126
} else {
127-
result = getDependTaskResult(dependentItem.getDepTaskCode(), dateInterval);
127+
result = getDependTaskResult(processInstance, dependentItem.getDepTaskCode(), dateInterval);
128128
}
129129
if (result != DependResult.SUCCESS) {
130130
break;
@@ -192,10 +192,15 @@ private DependResult dependResultByProcessInstance(ProcessInstance processInstan
192192
/**
193193
* get depend task result
194194
*/
195-
private DependResult getDependTaskResult(long taskCode, DateInterval dateInterval) {
195+
private DependResult getDependTaskResult(ProcessInstance processInstance, long taskCode, DateInterval dateInterval) {
196196
TaskInstance taskInstance = processService.findLastTaskInstanceInterval(taskCode, dateInterval);
197197
DependResult result;
198198
if (taskInstance == null) {
199+
if (!processInstance.getState().typeIsFinished()) {
200+
logger.info("Wait for the dependent workflow to complete, taskCode:{}, processInstanceId:{}, processInstance state:{}",
201+
taskCode, processInstance.getId(), processInstance.getState());
202+
return DependResult.WAITING;
203+
}
199204
TaskDefinition taskDefinition = processService.findTaskDefinitionByCode(taskCode);
200205
if (taskDefinition == null) {
201206
logger.error("Cannot find the task definition, something error, taskCode: {}", taskCode);

0 commit comments

Comments
 (0)