-
Notifications
You must be signed in to change notification settings - Fork 25
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
Improving the scheduling logic of the local engine #185
Conversation
Good point! It bothers me a little that this now changes the order of the queue if it finds a job which needs less resources. It would be nice to keep the FIFO property. You could just pull everything out of the Queue and store it in a normal list. Since the LocalEngine has only one thread checking for new tasks it shouldn't be a problem that a normal list isn't thread safe like the Queue. You can than simply iterate over the list and remove submitted jobs from it. |
ef5e080
to
eb77402
Compare
eb77402
to
43470da
Compare
Good point, changed it to a normal list (wrapped in sync_object to be safe). |
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.
Thanks for changing the PR. I think it looks good like that, but why do you are you using total_runnable_tasks
instead of just using len(runnable_tasks)
directly?
sisyphus/localengine.py
Outdated
|
||
# run next task if the capacities are available | ||
if next_task is not None: | ||
while runnable_task_idx < total_runnable_tasks: |
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.
Why not use len(runnable_tasks)
directly?
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.
Good question :D now I also don't see a reason to introduce the extra variable.
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.
Thanks for the changes, I like the this version much better :)
In the current implementation the LocalEngine always tries to schedule the first runnable task in its input queue (fifo). In cases where this jobs requires resources that are currently not available (e.g. a GPU), the scheduler waits till the resources are available even if there are smaller jobs that could be scheduled now.
As a very simple fix, with this change, if a task cannot be scheduled it is moved to the end of the queue and the next task is checked.