Skip to content
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

[Feature][Master] Run single task in workflow instance #13103

Merged
merged 1 commit into from
Dec 13, 2022

Conversation

jieguangzhou
Copy link
Member

@jieguangzhou jieguangzhou commented Dec 5, 2022

Purpose of the pull request

close: #12978

image

Brief change log

UI

  • In the Workflow Instance page, add three buttons if we Right-click the task
  • In the Workflow Instance page, if we save the workflow instance, will refresh instead of returning the workflow instance list page. (Because we can execute the task after editing the task definition directly)

Backend

  • Add an interface executeTask to execute the task
  • add a new function to clear data of existing task instance
  • fix the bug of inserting double same TaskDefinitionLogs in saveTaskDefine. (This will make some errors if we add and edit a new task definition in the workflow instance page)

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

@github-actions github-actions bot added backend UI ui and front end related labels Dec 5, 2022
@jieguangzhou jieguangzhou added this to the 3.2.0 milestone Dec 5, 2022
@jieguangzhou jieguangzhou added the 3.2.0 for 3.2.0 version label Dec 5, 2022
@jieguangzhou jieguangzhou self-assigned this Dec 5, 2022
@jieguangzhou jieguangzhou added the feature new feature label Dec 5, 2022
Set<String> taskCodesString = dag.getAllNodesList();

for (String taskCodeString : taskCodesString) {
long taskCode = Long.parseLong(taskCodeString);

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException

Potential uncaught 'java.lang.NumberFormatException'.
taskInstance = taskInstanceDao.findTaskByInstanceIdAndCode(processInstance.getId(), taskCode);
}
if (taskInstance == null) {
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to add some warn log.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an anomaly. If some task failed in the last execution of the workflow, the downstream task will not create a task instance. And then, taskInstance is null, we just ignore them.

@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2022

Codecov Report

Merging #13103 (e315788) into dev (26b7541) will increase coverage by 0.09%.
The diff coverage is 62.60%.

@@             Coverage Diff              @@
##                dev   #13103      +/-   ##
============================================
+ Coverage     39.28%   39.37%   +0.09%     
- Complexity     4277     4292      +15     
============================================
  Files          1069     1069              
  Lines         40305    40425     +120     
  Branches       4633     4642       +9     
============================================
+ Hits          15834    15919      +85     
- Misses        22685    22712      +27     
- Partials       1786     1794       +8     
Impacted Files Coverage Δ
...inscheduler/api/controller/ExecutorController.java 18.98% <0.00%> (-0.75%) ⬇️
...che/dolphinscheduler/common/enums/CommandType.java 0.00% <0.00%> (ø)
.../org/apache/dolphinscheduler/common/graph/DAG.java 94.48% <0.00%> (-0.75%) ⬇️
...duler/dao/repository/impl/TaskInstanceDaoImpl.java 3.33% <0.00%> (-0.06%) ⬇️
...nscheduler/service/process/ProcessServiceImpl.java 29.58% <23.07%> (-0.11%) ⬇️
.../server/master/runner/WorkflowExecuteRunnable.java 10.43% <65.85%> (+2.26%) ⬆️
...cheduler/api/service/impl/ExecutorServiceImpl.java 46.48% <73.33%> (+3.08%) ⬆️
...apache/dolphinscheduler/api/enums/ExecuteType.java 66.66% <100.00%> (ø)
.../org/apache/dolphinscheduler/api/enums/Status.java 100.00% <100.00%> (ø)
...er/master/dispatch/host/assign/RandomSelector.java 77.77% <0.00%> (-5.56%) ⬇️
... and 3 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jieguangzhou jieguangzhou marked this pull request as ready for review December 7, 2022 06:52
@jieguangzhou jieguangzhou force-pushed the execute-single-task branch 2 times, most recently from e315788 to d1cc4d6 Compare December 7, 2022 13:41
@jieguangzhou
Copy link
Member Author

@labbomb @songjianet @Amy0104 Please help to review the code of front end, thanks

@jieguangzhou
Copy link
Member Author

@caishunfeng @ruanwenjun Please help to review the backend code, thanks

@sonarcloud
Copy link

sonarcloud bot commented Dec 9, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

68.8% 68.8% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@caishunfeng caishunfeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@caishunfeng caishunfeng merged commit e4b9b67 into apache:dev Dec 13, 2022
@EricGao888
Copy link
Member

EricGao888 commented Mar 29, 2023

@jieguangzhou Hello, may I ask what's the relation between this PR and #10117 ? Seems there are some stuff overlapping with each other.

@jieguangzhou
Copy link
Member Author

@jieguangzhou Hello, may I ask what the relation between this PR and #10117 ? Seems there are some stuff overlapping with each other.

10177 runs from the workflow definition, while this pr runs from the workflow instance. Previously, if we runs a single task in 10177 and wanted to continue using that workflow instance to execute the next task, it was impossible. This PR solves this problem.

@EricGao888
Copy link
Member

@jieguangzhou Hello, may I ask what the relation between this PR and #10117 ? Seems there are some stuff overlapping with each other.

10177 runs from the workflow definition, while this pr runs from the workflow instance. Previously, if we runs a single task in 10177 and wanted to continue using that workflow instance to execute the next task, it was impossible. This PR solves this problem.

Cool, thx for the explanation : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.2.0 for 3.2.0 version backend feature new feature UI ui and front end related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature][Master] Run single task in workflow instance
5 participants