-
Notifications
You must be signed in to change notification settings - Fork 18
feat: Implement the task chunking RFC 0001 #168
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 the task chunking RFC 0001 #168
Conversation
fffedf4 to
a2b335c
Compare
Signed-off-by: Mark Wiebe <[email protected]>
a2b335c to
edfc0e3
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. Just a few nitpicks, but I don't consider them blocking. Feel free to address them or merge as-is.
| # If the string value has no expressions, can validate the value now. | ||
| # Otherwise will validate when |
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.
nit: this comment is unfinished
| pytest.param( | ||
| { | ||
| "name": "foo", | ||
| "type": "CHUNK[INT]", | ||
| "range": "1-100", | ||
| "chunks": { | ||
| "defaultTaskCount": 10, | ||
| "targetRuntimeSeconds": "{{Param.TargetChunkRuntime}}", | ||
| "rangeConstraint": "NONCONTIGUOUS", | ||
| }, | ||
| }, | ||
| id="targetRuntimeSeconds is str expression", | ||
| ), |
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.
nit: Should we also have a case where defaultTaskCount is a format string? I see it is already covered in test/openjd/model/v2023_09/test_create.py, but maybe for completeness it would be good to have here as well.
| }, | ||
| "Value must be an integer or integer string.", | ||
| 1, | ||
| id="disallow floats", |
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.
nit: should this mention "range"? same applies to test cases below this
| # Reject the string if it contains any expressions. | ||
| if len(item.expressions) == 0: | ||
| try: | ||
| int(item) | ||
| except ValueError: | ||
| errors.append( | ||
| InitErrorDetails( | ||
| type="value_error", | ||
| loc=(i,), | ||
| ctx={ | ||
| "error": ValueError( | ||
| "String literal must contain an integer." | ||
| ) | ||
| }, | ||
| input=item, | ||
| ) | ||
| ) |
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.
nit: this code comment doesn't match the implementation. It seems we are only rejecting strings if they have no expressions and the string cannot be parsed as an integer.
Thanks! I'll merge this and then open a smaller PR to fix up what you found. |


What was the problem/requirement? (What/Why)
https://github.com/OpenJobDescription/openjd-specifications/blob/mainline/rfcs/0001-task-chunking.md
What was the solution? (How)
Implement the task chunking additions as the TASK_CHUNKING extensions, using the context-sensitive parsing introduced by the Pydantic V2 conversion and extensions RFC implementation.
What is the impact of this change?
Job templates that use the task chunking feature can be parsed successfully.
How was this change tested?
Added tests for the new functionality.
Yes
Was this change documented?
Yes
Is this a breaking change?
Not a breaking change, it adds support for the TASK_CHUNKING extension.
Does this change impact security?
This does not impact the threat model, and the new extensions field and parameter follow the same level of input validation relevant for existing threats.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.