Browse Source

[Fix-10049] Conditions Task branch flow failed (#10077)

(cherry picked from commit 225cb332d1)
3.0.0/version-upgrade
xiangzihao 2 years ago committed by Jiajie Zhong
parent
commit
98576cb509
  1. 3
      docs/docs/en/guide/task/conditions.md
  2. 3
      docs/docs/zh/guide/task/conditions.md
  3. BIN
      docs/img/tasks/demo/condition_task04.png
  4. 10
      dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
  5. 5
      dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java
  6. 1
      dolphinscheduler-ui/src/locales/modules/en_US.ts
  7. 1
      dolphinscheduler-ui/src/locales/modules/zh_CN.ts
  8. 2
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-conditions.ts

3
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: 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. 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**. - 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_task03](/img/tasks/demo/condition_task03.png)
![condition_task04](/img/tasks/demo/condition_task04.png)

3
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 调度。如下图所示的情况是**错误**的。 - Conditions 的前置任务不能连接其分支节点,会造成逻辑混乱,不符合 DAG 调度。如下图所示的情况是**错误**的。
![condition_task03](/img/tasks/demo/condition_task03.png) ![condition_task03](/img/tasks/demo/condition_task03.png)
![condition_task04](/img/tasks/demo/condition_task04.png)

BIN
docs/img/tasks/demo/condition_task04.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

10
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()) { if (depTaskState.typeIsPause() || depTaskState.typeIsCancel()) {
return DependResult.NON_EXEC; return DependResult.NON_EXEC;
} }
// ignore task state if current task is condition and block // ignore task state if current task is block
if (taskNode.isConditionsTask() || taskNode.isBlockingTask()) { if (taskNode.isBlockingTask()) {
continue; continue;
} }
// always return success if current task is condition
if (taskNode.isConditionsTask()) {
continue;
}
if (!dependTaskSuccess(depsNode, taskCode)) { if (!dependTaskSuccess(depsNode, taskCode)) {
return DependResult.FAILED; return DependResult.FAILED;
} }

5
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(); this.setTaskExecutionLogger();
initTaskParameters(); initTaskParameters();
logger.info("dependent task start"); logger.info("condition task start");
return true; return true;
} }
@ -170,8 +170,7 @@ public class ConditionTaskProcessor extends BaseTaskProcessor {
logger.info("depend item : {} expect status: {}, actual status: {}", item.getDepTaskCode(), item.getStatus(), executionStatus); logger.info("depend item : {} expect status: {}, actual status: {}", item.getDepTaskCode(), item.getStatus(), executionStatus);
dependResult = DependResult.FAILED; dependResult = DependResult.FAILED;
} }
logger.info("dependent item complete {} {},{}", logger.info("dependent item complete, dependentTaskCode: {}, dependResult: {}", item.getDepTaskCode(), dependResult);
Constants.DEPENDENT_SPLIT, item.getDepTaskCode(), dependResult);
return dependResult; return dependResult;
} }

1
dolphinscheduler-ui/src/locales/modules/en_US.ts

@ -822,6 +822,7 @@ const project = {
sea_tunnel_queue: 'Queue', sea_tunnel_queue: 'Queue',
sea_tunnel_master_url_tips: sea_tunnel_master_url_tips:
'Please enter the master url, e.g., 127.0.0.1:7077', '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_condition: 'Condition',
switch_branch_flow: 'Branch Flow', switch_branch_flow: 'Branch Flow',
and: 'and', and: 'and',

1
dolphinscheduler-ui/src/locales/modules/zh_CN.ts

@ -811,6 +811,7 @@ const project = {
sea_tunnel_master_url: 'Master URL', sea_tunnel_master_url: 'Master URL',
sea_tunnel_queue: '队列', sea_tunnel_queue: '队列',
sea_tunnel_master_url_tips: '请直接填写地址,例如:127.0.0.1:7077', sea_tunnel_master_url_tips: '请直接填写地址,例如:127.0.0.1:7077',
add_pre_task_check_condition: '添加前置检查条件',
switch_condition: '条件', switch_condition: '条件',
switch_branch_flow: '分支流转', switch_branch_flow: '分支流转',
and: '且', and: '且',

2
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', childrenField: 'dependItemList',
name: 'custom_parameters' name: 'add_pre_task_check_condition'
}) })
] ]
} }

Loading…
Cancel
Save