You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/05/18 03:40:36 UTC

[dolphinscheduler] branch dev updated: [Fix-10049] Conditions Task branch flow failed (#10077)

This is an automated email from the ASF dual-hosted git repository.

zhongjiajie pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 225cb332d1 [Fix-10049] Conditions Task branch flow failed (#10077)
225cb332d1 is described below

commit 225cb332d18e2fef58bf653d644f415dfcce2e99
Author: xiangzihao <46...@qq.com>
AuthorDate: Wed May 18 11:40:32 2022 +0800

    [Fix-10049] Conditions Task branch flow failed (#10077)
---
 docs/docs/en/guide/task/conditions.md                   |   3 ++-
 docs/docs/zh/guide/task/conditions.md                   |   3 ++-
 docs/img/tasks/demo/condition_task04.png                | Bin 0 -> 33271 bytes
 .../server/master/runner/WorkflowExecuteThread.java     |  10 ++++++++--
 .../master/runner/task/ConditionTaskProcessor.java      |   5 ++---
 dolphinscheduler-ui/src/locales/modules/en_US.ts        |   1 +
 dolphinscheduler-ui/src/locales/modules/zh_CN.ts        |   1 +
 .../task/components/node/fields/use-conditions.ts       |   2 +-
 8 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/docs/docs/en/guide/task/conditions.md b/docs/docs/en/guide/task/conditions.md
index 4bd8094648..df723b355b 100644
--- a/docs/docs/en/guide/task/conditions.md
+++ b/docs/docs/en/guide/task/conditions.md
@@ -47,7 +47,7 @@ Go to the workflow definition page, and then create the following task nodes:
 
 After you finish creating the workflow, you can run the workflow online. You can view the execution status of each task on the workflow instance page. As shown below:
 
-![condition_task01](/img/tasks/demo/condition_task02.png)
+![condition_task02](/img/tasks/demo/condition_task02.png)
 
 In the above figure, the task status marked with a green check mark is the successfully executed task node.
 
@@ -58,3 +58,4 @@ In the above figure, the task status marked with a green check mark is the succe
 - The predecessor task of Conditions cannot connect to its branch nodes, which will cause logical confusion and does not conform to DAG scheduling. The situation shown below is **wrong**.
 
 ![condition_task03](/img/tasks/demo/condition_task03.png)
+![condition_task04](/img/tasks/demo/condition_task04.png)
diff --git a/docs/docs/zh/guide/task/conditions.md b/docs/docs/zh/guide/task/conditions.md
index 66f11fa3ed..c7fef6d6f1 100644
--- a/docs/docs/zh/guide/task/conditions.md
+++ b/docs/docs/zh/guide/task/conditions.md
@@ -47,7 +47,7 @@ Conditions 是一个条件节点,根据上游任务运行状态,判断应该
 
 当完成创建工作流之后,可以上线运行该工作流。在工作流实例页面可以查看到各个任务的执行状态。如下图所示:
 
-![condition_task01](/img/tasks/demo/condition_task02.png)
+![condition_task02](/img/tasks/demo/condition_task02.png)
 
 上图中,任务状态标记为绿色对号的,即为成功执行的任务节点。
 
@@ -58,3 +58,4 @@ Conditions 是一个条件节点,根据上游任务运行状态,判断应该
 - Conditions 的前置任务不能连接其分支节点,会造成逻辑混乱,不符合 DAG 调度。如下图所示的情况是**错误**的。
 
 ![condition_task03](/img/tasks/demo/condition_task03.png)
+![condition_task04](/img/tasks/demo/condition_task04.png)
diff --git a/docs/img/tasks/demo/condition_task04.png b/docs/img/tasks/demo/condition_task04.png
new file mode 100644
index 0000000000..9da10be464
Binary files /dev/null and b/docs/img/tasks/demo/condition_task04.png differ
diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
index 3b7b5511ae..a40b7e5b27 100644
--- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
+++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
@@ -1376,10 +1376,16 @@ public class WorkflowExecuteThread {
                 if (depTaskState.typeIsPause() || depTaskState.typeIsCancel()) {
                     return DependResult.NON_EXEC;
                 }
-                // ignore task state if current task is condition and block
-                if (taskNode.isConditionsTask() || taskNode.isBlockingTask()) {
+                // ignore task state if current task is block
+                if (taskNode.isBlockingTask()) {
                     continue;
                 }
+
+                // always return success if current task is condition
+                if (taskNode.isConditionsTask()) {
+                    continue;
+                }
+
                 if (!dependTaskSuccess(depsNode, taskCode)) {
                     return DependResult.FAILED;
                 }
diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java
index 0928d122ba..4749e20f0f 100644
--- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java
+++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java
@@ -68,7 +68,7 @@ public class ConditionTaskProcessor extends BaseTaskProcessor {
         }
         this.setTaskExecutionLogger();
         initTaskParameters();
-        logger.info("dependent task start");
+        logger.info("condition task start");
         return true;
     }
 
@@ -170,8 +170,7 @@ public class ConditionTaskProcessor extends BaseTaskProcessor {
             logger.info("depend item : {} expect status: {}, actual status: {}", item.getDepTaskCode(), item.getStatus(), executionStatus);
             dependResult = DependResult.FAILED;
         }
-        logger.info("dependent item complete {} {},{}",
-                Constants.DEPENDENT_SPLIT, item.getDepTaskCode(), dependResult);
+        logger.info("dependent item complete, dependentTaskCode: {}, dependResult: {}", item.getDepTaskCode(), dependResult);
         return dependResult;
     }
 
diff --git a/dolphinscheduler-ui/src/locales/modules/en_US.ts b/dolphinscheduler-ui/src/locales/modules/en_US.ts
index 1f19d64e0d..daf142b35a 100644
--- a/dolphinscheduler-ui/src/locales/modules/en_US.ts
+++ b/dolphinscheduler-ui/src/locales/modules/en_US.ts
@@ -822,6 +822,7 @@ const project = {
     sea_tunnel_queue: 'Queue',
     sea_tunnel_master_url_tips:
       'Please enter the master url, e.g., 127.0.0.1:7077',
+    add_pre_task_check_condition: 'Add pre task check condition',
     switch_condition: 'Condition',
     switch_branch_flow: 'Branch Flow',
     and: 'and',
diff --git a/dolphinscheduler-ui/src/locales/modules/zh_CN.ts b/dolphinscheduler-ui/src/locales/modules/zh_CN.ts
index 108256fec5..e9c4133907 100644
--- a/dolphinscheduler-ui/src/locales/modules/zh_CN.ts
+++ b/dolphinscheduler-ui/src/locales/modules/zh_CN.ts
@@ -811,6 +811,7 @@ const project = {
     sea_tunnel_master_url: 'Master URL',
     sea_tunnel_queue: '队列',
     sea_tunnel_master_url_tips: '请直接填写地址,例如:127.0.0.1:7077',
+    add_pre_task_check_condition: '添加前置检查条件',
     switch_condition: '条件',
     switch_branch_flow: '分支流转',
     and: '且',
diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-conditions.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-conditions.ts
index 356e6e0dd3..53df0bba75 100644
--- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-conditions.ts
+++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-conditions.ts
@@ -121,7 +121,7 @@ export function useConditions(model: { [field: string]: any }): IJsonItem[] {
         ]
       },
       childrenField: 'dependItemList',
-      name: 'custom_parameters'
+      name: 'add_pre_task_check_condition'
     })
   ]
 }