-
Notifications
You must be signed in to change notification settings - Fork 4
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
Define Kubernetes Workflow Resources #121
Conversation
Codecov Report
@@ Coverage Diff @@
## master #121 +/- ##
==========================================
+ Coverage 92.31% 92.40% +0.08%
==========================================
Files 61 63 +2
Lines 1914 1988 +74
Branches 326 332 +6
==========================================
+ Hits 1767 1837 +70
- Misses 71 75 +4
Partials 76 76
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I think it's OK to define partial resource definitions, then we would fill with the rest with defaults (static in Having no resource definitions is fine
I think they are fine to be able to be used in all step definitions~ Did you have something in mind where we would need to limit their availability? |
No, just wanted to make sure there wasn’t some restriction I was unaware of. |
fb1122e
to
fc07c16
Compare
Initial commit to check progress -- will be amended later. Add workflow resources to the step YAML configuration. Add resources to the parser -> create serializable objects.
If the `resources` key is defined, it must contain all the defined properties.
You can omit any resource (cpu, memory, devices) and their properties as long as the YAML is valid.
Filename reflected old class name
Workload properties (and sub-properties) are optional; make sure mising properties have a value of None on every level.
Will tidy up the commit history before merging. |
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 think the new objects do not implement the established Item
interface, see comments
fc07c16
to
e750834
Compare
Due to some pending changes in the typing, the subresources need to be introduced first in the module. This commit is just to help review the changes made to the classes in the next commit (Git is not good with reorganization and changes done in the same commit).
Non-idiomatic use of Item classes changed to use the `parse` method for constructing the object, and type parameters for the classes (instead of dicts).
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.
comments + as mentioned, types might need a refresh
Re: review comment at #121 (comment) Overriding the `parse` method not needded for cpu and memory where the properties are known (the parameter name just needs to match the YAML property).
Correctly define workflow resources parameter type [1] - fixing parsing makes this just work Use SerializedDict as device resources init type [2] - passed from parse [1] #121 (comment) [2] #121 (comment)
Re: review comment at #121 (comment) Overriding the `parse` method not needded for cpu and memory where the properties are known (the parameter name just needs to match the YAML property).
Correctly define workflow resources parameter type [1] - fixing parsing makes this just work Use SerializedDict as device resources init type [2] - passed from parse [1] #121 (comment) [2] #121 (comment)
0f85766
to
14b70b9
Compare
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 think it looks good now, rebase and we can go ahead! 💯
Related to https://github.com/valohai/meta/issues/275
Add a
resources
property to Step for defining Kubernetes resources.All resources (cpu, memory, devices) are required if
resources
is given.Example step definition
Testing
examples/step-with-resources.yaml
– contains all resource definition propertiesexamples/step-with-partial-resources.yaml
– an example of defining only some of the propertieserror_examples/step-invalid-resources.yaml
– an example of invalid resources that cause a validation errortest_workload_resources.py
– unit tests for the WorkloadResources objectOpen questions