-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Fix condition task will cause workflow instance failed #16152
Conversation
9e39ea4
to
5f22c84
Compare
/** | ||
* Whether the task instance need to put into {@link #errorTaskMap}. | ||
* Only the task instance is failed or killed, and it is parent of condition task. | ||
* Then it should be put into {@link #errorTaskMap}. | ||
* <p> Once a task instance is put into {@link #errorTaskMap}, it will be thought as failed and make the workflow be failed. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
log.info("The condition result is {}", conditionResult); | ||
taskParameters.setConditionSuccess(conditionResult == DependResult.SUCCESS); | ||
taskInstance.setConditionsParameters(taskParameters); | ||
taskExecutionContext.setCurrentExecutionStatus(TaskExecutionStatus.SUCCESS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update the docs too.
see https://dolphinscheduler.apache.org/zh-cn/docs/3.2.1/guide/task/conditions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the doc is correct, we don't need to update it.
Map<String, Object> taskParamsMap = new HashMap<>(); | ||
taskParamsMap.put(Constants.SWITCH_RESULT, ""); | ||
taskInstance.setTaskParams(JSONUtils.toJsonString(taskParamsMap)); | ||
taskInstance.setState(TaskExecutionStatus.FAILURE); | ||
completeTaskList.put(3L, taskInstance); | ||
postNodes = DagHelper.parsePostNodes(null, skipNodeList, dag, completeTaskList); | ||
Assertions.assertEquals(1, postNodes.size()); | ||
Assertions.assertTrue(postNodes.contains(6L)); | ||
Assertions.assertEquals(2, skipNodeList.size()); | ||
Assertions.assertTrue(skipNodeList.containsKey(5L)); | ||
Assertions.assertTrue(skipNodeList.containsKey(7L)); | ||
|
||
// dag: 1-2-3-5-7 4-3-6 | ||
// 3-if , complete:1/2/3/4 | ||
// 1.failure:3 expect post:6 skip:5/7 | ||
dag = generateDag2(); | ||
skipNodeList.clear(); | ||
completeTaskList.clear(); | ||
taskInstance.setSwitchDependency(getSwitchNode()); | ||
completeTaskList.put(1L, taskInstance); | ||
postNodes = DagHelper.parsePostNodes(1L, skipNodeList, dag, completeTaskList); | ||
Assertions.assertEquals(1, postNodes.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe should keep the switch UT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have switch UT case, and it's better to split the switch case from condition case. we need to make the case is small enough to maintain.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #16152 +/- ##
============================================
- Coverage 41.07% 40.98% -0.09%
+ Complexity 5155 5146 -9
============================================
Files 1399 1399
Lines 44856 44844 -12
Branches 4756 4735 -21
============================================
- Hits 18423 18381 -42
- Misses 24628 24653 +25
- Partials 1805 1810 +5 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Quality Gate failedFailed conditions |
(cherry picked from commit 5df4b1c)
Purpose of the pull request
close #16150
Brief change log
Verify this pull request
This pull request is code cleanup without any test coverage.
(or)
This pull request is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(or)
If your pull request contain incompatible change, you should also add it to
docs/docs/en/guide/upgrede/incompatible.md