From 7835ddfdb769306ef4c776a43a162a1b0fde3aca Mon Sep 17 00:00:00 2001 From: ralphgj Date: Wed, 19 Apr 2023 15:40:51 +0800 Subject: [PATCH] [Fix-13780][api] Fix the problem of process instance DAG can't show dependent task (#13823) --- .../api/service/impl/ProcessInstanceServiceImpl.java | 7 ++++--- .../api/service/ProcessInstanceServiceTest.java | 2 +- .../server/master/runner/task/DependentTaskProcessor.java | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java index 69620e7640..6fb10fd431 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java @@ -526,11 +526,12 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce } String dependResultString = tmpStringArray[1]; String[] dependStringArray = dependResultString.split(","); - if (dependStringArray.length != 2) { + if (dependStringArray.length != 3) { continue; } - String key = dependStringArray[0].trim(); - DependResult dependResult = DependResult.valueOf(dependStringArray[1].trim()); + String key = dependStringArray[0].trim().split(":")[1].trim(); + String result = dependStringArray[1].trim().split(":")[1].trim(); + DependResult dependResult = DependResult.valueOf(result); resultMap.put(key, dependResult); } } diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java index 0282049d44..b35b9ccf3c 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java @@ -465,7 +465,7 @@ public class ProcessInstanceServiceTest { public void testParseLogForDependentResult() throws IOException { String logString = "[INFO] 2019-03-19 17:11:08.475 org.apache.dolphinscheduler.server.worker.log.TaskLogger:[172]" - + " - [taskAppId=TASK_223_10739_452334] dependent item complete :|| 223-ALL-day-last1Day,SUCCESS\n" + + " - [taskAppId=TASK_223_10739_452334] dependent item complete, :|| dependentKey: 223-ALL-day-last1Day, result: SUCCESS, dependentDate: Wed Mar 19 17:10:36 CST 2019\n" + "[INFO] 2019-03-19 17:11:08.476 org.apache.dolphinscheduler.server.worker.runner.TaskScheduleThread:[172]" + " - task : 223_10739_452334 exit status code : 0\n" + "[root@node2 current]# "; diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java index 372305c996..a7d807cba3 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java @@ -17,6 +17,7 @@ package org.apache.dolphinscheduler.server.master.runner.task; +import static org.apache.dolphinscheduler.common.constants.Constants.DEPENDENT_SPLIT; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_DEPENDENT; import org.apache.dolphinscheduler.common.constants.Constants; @@ -255,8 +256,8 @@ public class DependentTaskProcessor extends BaseTaskProcessor { if (!dependResultMap.containsKey(entry.getKey())) { dependResultMap.put(entry.getKey(), entry.getValue()); // save depend result to log - log.info("dependent item complete, dependentKey: {}, result: {}, dependentDate: {}", - entry.getKey(), entry.getValue(), dependentDate); + log.info("dependent item complete, {} dependentKey: {}, result: {}, dependentDate: {}", + DEPENDENT_SPLIT, entry.getKey(), entry.getValue(), dependentDate); } } if (!dependentExecute.finish(dependentDate, testFlag)) {