-
Notifications
You must be signed in to change notification settings - Fork 18
feat!: Implement step parameter space iteration for chunks #172
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
feat!: Implement step parameter space iteration for chunks #172
Conversation
7ed8d49 to
c9a52e5
Compare
jusiskin
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.
Great job with this code change.
I haven't finished my review pass yet, but wanted to surface one thing we should add to help clarify an assumption here.
139032d to
beeaec2
Compare
leongdl
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.
This will take me some time to understand all the logic.
| if chunks_default_task_count <= 0: | ||
| chunk_count = 1 | ||
| else: | ||
| chunk_count = (task_count + chunks_default_task_count - 1) // chunks_default_task_count |
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.
That's an interesting way to implement something almost like ceiling!
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.
If you messed around with graphics code like implementing https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm#Algorithm_for_integer_arithmetic and similar this stuff is pretty natural :)
jusiskin
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.
Great job with this, @mwiebe! Just a few suggested changes here.
acabd96 to
63fc330
Compare
leongdl
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.
I generally understand the logic, but probably need to do a few more thinking passes to walk through the logic.
63fc330 to
2011e71
Compare
2011e71 to
8e678bd
Compare
* Modify StepParameterSpaceIterator to handle parameter spaces that
include a CHUNK[INT] parameter. The iteration pattern depends on the
values in the 'chunks' object of the parameter definition.
* If targetRuntimeSeconds is 0 or unspecified, split the CHUNK[INT]
dimension into chunks, and then iterate over the whole space with
that selection of chunks.
* If targetRuntimeSeconds is a positive integer, move the CHUNK[INT]
dimension to the innermost loop, and dynamically select the chunk
each time it advances. Let the user of the iterator modify its
chunks_default_task_count to adapt the chunk size over time.
* The StepParameterSpaceIterator object behaved more like a
pseudo-container than an iterator. Change it to act as the iterator
itself (returning 'self' from __iter__() instead of a new object).
* Changed how the special case zero-dimensional iteration works to be
a Node/Iterator pair just like the others, for a more uniform
interface.
* Changes to IntRangeExpr:
* Fix a bug in IntRangeExpr.from_list that wasn't handling the end of a
linear sequence correctly.
* Change the string representation of IntRangeExpr to use "," instead of
"-" when there are just two values.
* Add and update unit tests for all of the modifications.
* Update parameter space validation to ensure only one CHUNK[INT]
parameter is defined.
BREAKING CHANGE: This change includes a few small changes to the public contract
of IntRangeExpr and the StepParameterSpaceIterator. Most code won't depend
on these specifics, but some could.
Signed-off-by: Mark Wiebe <[email protected]>
8e678bd to
f1bfdf3
Compare
|



What was the problem/requirement? (What/Why)
To use task chunking as defined by https://github.com/OpenJobDescription/openjd-specifications/blob/mainline/rfcs/0001-task-chunking.md, clients of the library need to be able to iterate over a parameter space based on chunking.
What was the solution? (How)
What is the impact of this change?
Clients such as the openjd CLI command will be able to use chunked iteration of parameter spaces to run job templates that include chunking.
How was this change tested?
Implemented unit tests for the new chunked iteration modes.
Was this change documented?
Updated docstrings about chunked iteration.
Is this a breaking change?
This change includes a few small changes to the public contract of IntRangeExpr and the StepParameterSpaceIterator. Most code won't depend on these specifics, but some could.
Does this change impact security?
No
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.