-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(sdk): Support setting cpu/memory requests. #9121
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
0eadd76
to
95529f8
Compare
/assign @connor-mccarthy |
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.
/lgtm
Thanks, @chensun.
|
||
if self.container_spec is None: | ||
raise ValueError( | ||
'There is no container specified in implementation') |
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.
Does it make sense to convert this to a more user-facing message indicating that cpu can only be set on single-step components, not pipelines used as a component?
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.
Also, maybe it makes sense to move this shared check into the validate method (or a separate validation method) for DRY code? Not sure what's best, but want to mention it.
c6cb0af
to
6c4cdc3
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.
/lgtm
@@ -246,6 +246,13 @@ def set_caching_options(self, enable_caching: bool) -> 'PipelineTask': | |||
self._task_spec.enable_caching = enable_caching | |||
return self | |||
|
|||
def _ensure_container_spec_exists(self) -> None: |
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.
Micro improvement suggestion: Could also use a method_name: str
param to which you pass self.set_memory_limit.__name__
from within .set_memory_limit()
(or whatever the method is) to include the method name in the error message.
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.
Can't really reference self.func
from within the same func
. Opted to use inspect to achieve the same goal.
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.
SG. inspect
works!
Here's what I had in mind. Curious, where did things break down?
class Cls:
def method(self):
self.printer(self.method.__name__)
def printer(self, name):
print(name)
Cls().method()
>>> 'method'
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.
Okay, that works, I thought I tried the same and got the error but maybe I missed something else.
Anyway, I think I'll keep the inspect approach in favor of there's less effort for the caller to pass in values.
@chensun: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
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.
/lgtm
kubeflow-pipelines-sdk-execution-tests failure is known issue unrelated to the change, and it's expected to be resolved by next backend release. Merge as-is. |
* Support setting cpu/memory requests. * address review comments * address review comments
Description of your changes:
Checklist: