-
Notifications
You must be signed in to change notification settings - Fork 93
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
Use OrderedDict for queues to make them FIFO #2584
Conversation
@matthewrmshin - this change seems sensible (and satisfyingly simple!) - is at good for review now as far as you're concerned (@TomekTrzeciak is one of your colleagues, no?) |
Yes and yes. |
This change doesn't have the desired effect! Here's a test suite that contrives to adds tasks proc_1..5 to the 'q1' queue in order, before any are released to run:
On running it, |
I suspect you thought (naturally enough) that This is - I think - an almost minimal implementation to achieve the current random release behaviour. To get ordered/prioritized release, we'll need a slightly more sophisticated queue model (perhaps involving actual "queue" data structures!). |
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.
(given the small size of this change - unless my analysis is way off base - might as well close the PR and revisit later with a new queue implementation)
I believe I fixed the issue in my latest commit ( |
Nice, good job. I wonder if it might be more elegant to separate the (now) two functionalities of self.queues, and use a deque for the FIFO bit? |
1f3b2af
to
80a49c9
Compare
I had a similar thought about using deque, but that would require more substantial redesign of the queues. I've added two more commits: one to fix loss of queue ordering on reload (queues were reinitialised as regular dicts) and the second one to make runahead pool into FIFO too, so that tasks are migrated to queues is the spawn order (I think this might matter for queues without limits, like the default one, but I haven't test it). |
Nice. This is certainly an improvement. It even does the right thing if I turn the example above into a cycling suite:
|
@TomekTrzeciak - to finish this off, could you:
|
Done. I found and fixed one more bug in there (and fixed a typo in the docs). |
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.
looks good now
Partial fix for #1196.