-
Notifications
You must be signed in to change notification settings - Fork 124
WQ: Iterate whole ready list if task priority has been set #4279
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
base: master
Are you sure you want to change the base?
WQ: Iterate whole ready list if task priority has been set #4279
Conversation
btovar
left a comment
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.
ready to merge?
|
Hold on a minute... |
|
I don't think |
|
You're right I think. Maybe I can just switch back to list_iterate |
|
list_rotate was added for performance advantages, right? |
|
That could get complicated quickly if we are pushing new tasks with priorities while the list is out of order |
68b764b to
1a7b200
Compare
|
We can avoid the code duplication if you use a function pointer for whether to use list_nextitem or list_rotate, and update q->attempt_schedule_depth to the length of the ready_queue every time when using priorities. |
|
Is it necessary to call list_first_item before iterating the list normally? |
|
Careful! You are iterating over the list but using |
|
@dthain any thoughts? Maybe we create a new branch for Ben C to test first? |
|
I'm happy to test whatever branch. I'm also happy to build from source so you don't to do more than point me at a suitable git branch/commit. |
|
Colin, if you think it's ready to go, then let's have BenC give it a test drive. |
|
@benclifford If you don't mind cloning my repo feel free to take the latest commit here and see if it helps your issue. I am uncertain about the throughput implications with your particular application. |
|
I tried this PR with the test run that I was originally complaining about in issue #4276 and it looks good. This plot is of a run which is intended to run longer tasks before shorter tasks, assuming the submitter knows the task duration, and it looks like that is true (apart from one startup task that I think is probably expected due to submission time/order). The context for that is this blog post https://parsl-project.org/2025/11/08/priority.html
|
|
Thank you for brining this up and then testing. |
work_queue/src/work_queue.c
Outdated
| change_task_state(q, t, WORK_QUEUE_TASK_RETRIEVED); | ||
| expired++; | ||
| list_pop_tail(q->ready_list); | ||
| list_remove(q->ready_list, t); |
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.
Any reason you changed to list_remove? This would cause wq to check the whole list as the task is in the tail?
|
The issue here is that |
|
I'll update this pr with list_item_remove, merge it and make a release. |
|
It looks like list_drop requires a reference to the existing cursor which is not available outside list.c unless we re implement the iteration method using the more primitive functions |

Proposed Changes
Addresses #4276
We cannot partially iterate the ready list and leave it out of order if we wish to maintain priority scheduling. If a task priority is set by the user, revert to iterating the entire list each scheduling attempt.
Merge Checklist
The following items must be completed before PRs can be merged.
Check these off to verify you have completed all steps.
make testRun local tests prior to pushing.make formatFormat source code to comply with lint policies. Note that some lint errors can only be resolved manually (e.g., Python)make lintRun lint on source code prior to pushing.