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

[Improvement] Remove taskQueue and looper in worker #15292

Conversation

ruanwenjun
Copy link
Member

@ruanwenjun ruanwenjun commented Dec 8, 2023

Purpose of the pull request

Since we have put the delay logic from worker to master, there is no need to add task queue in worker, this will cause it's not convenient to judge the task size, and we need to use a thread to loop the task queue.

This pr will remove the extra task queue in worker, directly use the thread pool's queue as task queue.

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

@ruanwenjun ruanwenjun force-pushed the dev_wenjun_renameMasterLogicTaskExecuteRunnable branch 3 times, most recently from b43261d to c783836 Compare December 8, 2023 04:22
@codecov-commenter
Copy link

codecov-commenter commented Dec 8, 2023

Codecov Report

Attention: 126 lines in your changes are missing coverage. Please review.

Comparison is base (74fd24b) 37.80% compared to head (23878af) 38.10%.

❗ Current head 23878af differs from pull request most recent head 283d52d. Consider uploading reports for the commit 283d52d to get more accurate results

Files Patch % Lines
...er/worker/runner/WorkerTaskExecutorThreadPool.java 50.00% 15 Missing and 2 partials ⚠️
...r/execute/MasterTaskExecutorThreadPoolManager.java 0.00% 16 Missing ⚠️
...er/operator/TaskInstanceKillOperationFunction.java 0.00% 12 Missing ⚠️
.../operator/UpdateWorkflowHostOperationFunction.java 0.00% 12 Missing ⚠️
...ner/execute/MasterAsyncTaskExecutorThreadPool.java 0.00% 10 Missing ⚠️
...r/runner/GlobalTaskDispatchWaitingQueueLooper.java 0.00% 8 Missing ⚠️
...e/dolphinscheduler/server/worker/WorkerServer.java 0.00% 8 Missing ⚠️
...nner/execute/MasterSyncTaskExecutorThreadPool.java 0.00% 7 Missing ⚠️
...server/worker/runner/WorkerTaskExecutorHolder.java 41.66% 6 Missing and 1 partial ⚠️
...uler/server/worker/message/MessageRetryRunner.java 0.00% 6 Missing ⚠️
... and 12 more
Additional details and impacted files
@@             Coverage Diff              @@
##                dev   #15292      +/-   ##
============================================
+ Coverage     37.80%   38.10%   +0.29%     
- Complexity     4681     4698      +17     
============================================
  Files          1304     1301       -3     
  Lines         44937    44800     -137     
  Branches       4812     4800      -12     
============================================
+ Hits          16990    17071      +81     
+ Misses        26098    25877     -221     
- Partials       1849     1852       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ruanwenjun ruanwenjun force-pushed the dev_wenjun_renameMasterLogicTaskExecuteRunnable branch from c783836 to 7f77e6c Compare December 18, 2023 00:53
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_renameMasterLogicTaskExecuteRunnable branch 3 times, most recently from 1782419 to 79d2e34 Compare December 26, 2023 12:56
Comment on lines 54 to 58
// todo: remove this method
ThreadPoolExecutor getThreadPool() {
return threadPoolExecutor;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add more comments for it? You added this method but the todo is the remove method, which seems a bit strange.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -128,26 +107,4 @@ public void stop(String cause) {
close(cause);
}

public void killAllRunningTasks() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we keep this method to make sure all task are canceled when worker down, WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I keep this method, and add todo.

@caishunfeng caishunfeng added the improvement make more easy to user or prompt friendly label Dec 27, 2023
@caishunfeng caishunfeng changed the title Remove taskQueue and looper in worker [Improvement] Remove taskQueue and looper in worker Dec 27, 2023
@caishunfeng
Copy link
Contributor

Please add some pr description.

@ruanwenjun ruanwenjun force-pushed the dev_wenjun_renameMasterLogicTaskExecuteRunnable branch from 79d2e34 to 30a5d41 Compare December 27, 2023 03:06
@ruanwenjun
Copy link
Member Author

Please add some pr description.

Done

@ruanwenjun ruanwenjun force-pushed the dev_wenjun_renameMasterLogicTaskExecuteRunnable branch from 30a5d41 to 7dc5447 Compare December 27, 2023 03:24
if (ProcessUtils.kill(taskRequest)) {
TaskExecutionContext taskExecutionContext = workerTaskExecutor.getTaskExecutionContext();
LogUtils.setTaskInstanceIdMDC(taskExecutionContext.getTaskInstanceId());
if (ProcessUtils.kill(taskExecutionContext)) {

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
ProcessUtils.kill
should be avoided because it has been deprecated.
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.

LGTM

@caishunfeng caishunfeng added this to the 3.2.1 milestone Dec 27, 2023
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_renameMasterLogicTaskExecuteRunnable branch from 7dc5447 to 283d52d Compare December 27, 2023 10:24
Copy link

sonarcloud bot commented Dec 27, 2023

Quality Gate Failed Quality Gate failed

Failed conditions

17.1% Coverage on New Code (required ≥ 60%)

See analysis details on SonarCloud

@ruanwenjun ruanwenjun merged commit 5523a62 into apache:dev Dec 27, 2023
51 of 52 checks passed
@ruanwenjun ruanwenjun deleted the dev_wenjun_renameMasterLogicTaskExecuteRunnable branch December 27, 2023 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend improvement make more easy to user or prompt friendly ready-to-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants