Browse Source

[Fix-13780][api] Fix the problem of process instance DAG can't show dependent task (#13823)

3.2.0-release
ralphgj 2 years ago committed by GitHub
parent
commit
7835ddfdb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
  2. 2
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
  3. 5
      dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java

7
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 dependResultString = tmpStringArray[1];
String[] dependStringArray = dependResultString.split(","); String[] dependStringArray = dependResultString.split(",");
if (dependStringArray.length != 2) { if (dependStringArray.length != 3) {
continue; continue;
} }
String key = dependStringArray[0].trim(); String key = dependStringArray[0].trim().split(":")[1].trim();
DependResult dependResult = DependResult.valueOf(dependStringArray[1].trim()); String result = dependStringArray[1].trim().split(":")[1].trim();
DependResult dependResult = DependResult.valueOf(result);
resultMap.put(key, dependResult); resultMap.put(key, dependResult);
} }
} }

2
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java

@ -465,7 +465,7 @@ public class ProcessInstanceServiceTest {
public void testParseLogForDependentResult() throws IOException { public void testParseLogForDependentResult() throws IOException {
String logString = String logString =
"[INFO] 2019-03-19 17:11:08.475 org.apache.dolphinscheduler.server.worker.log.TaskLogger:[172]" "[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]" + "[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" + " - task : 223_10739_452334 exit status code : 0\n"
+ "[root@node2 current]# "; + "[root@node2 current]# ";

5
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; 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 static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_DEPENDENT;
import org.apache.dolphinscheduler.common.constants.Constants; import org.apache.dolphinscheduler.common.constants.Constants;
@ -255,8 +256,8 @@ public class DependentTaskProcessor extends BaseTaskProcessor {
if (!dependResultMap.containsKey(entry.getKey())) { if (!dependResultMap.containsKey(entry.getKey())) {
dependResultMap.put(entry.getKey(), entry.getValue()); dependResultMap.put(entry.getKey(), entry.getValue());
// save depend result to log // save depend result to log
log.info("dependent item complete, dependentKey: {}, result: {}, dependentDate: {}", log.info("dependent item complete, {} dependentKey: {}, result: {}, dependentDate: {}",
entry.getKey(), entry.getValue(), dependentDate); DEPENDENT_SPLIT, entry.getKey(), entry.getValue(), dependentDate);
} }
} }
if (!dependentExecute.finish(dependentDate, testFlag)) { if (!dependentExecute.finish(dependentDate, testFlag)) {

Loading…
Cancel
Save