-
Notifications
You must be signed in to change notification settings - Fork 312
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
Rename container_image to image for improved UX #3094
base: master
Are you sure you want to change the base?
Rename container_image to image for improved UX #3094
Conversation
1. Support both `image` and `container_image` for backward compatibility 2. Modify the core decorator used for any task type * We focus on the user-facing inteface Signed-off-by: JiangJiaWei1103 <[email protected]>
Code Review Agent Run Status
|
…tests Signed-off-by: JiangJiaWei1103 <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3094 +/- ##
==========================================
- Coverage 76.85% 76.22% -0.63%
==========================================
Files 206 206
Lines 21851 21875 +24
Branches 2837 2840 +3
==========================================
- Hits 16794 16675 -119
- Misses 4269 4363 +94
- Partials 788 837 +49 ☔ View full report in Codecov by Sentry. |
Code Review Agent Run Status
|
Signed-off-by: JiangJiaWei1103 <[email protected]>
Signed-off-by: JiangJiaWei1103 <[email protected]>
Signed-off-by: JiangJiaWei1103 <[email protected]>
Code Review Agent Run Status
|
Code Review Agent Run #e396c5Actionable Suggestions - 3
Review Details
|
Changelist by BitoThis pull request implements the following key changes.
|
1. Validate `image` and `container_image` in `PythonAutoContainerTask`'s initializer 2. Maintain backward compatibility within `PythonAutoContainerTask` Signed-off-by: JiangJiaWei1103 <[email protected]>
Code Review Agent Run #5e8094Actionable Suggestions - 2
Review Details
|
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.
Minor nit on adding a comment
Signed-off-by: JiangJiaWei1103 <[email protected]>
e66743f
Code Review Agent Run #acb303Actionable Suggestions - 0Review Details
|
Code Review Agent Run #74c115Actionable Suggestions - 0Additional Suggestions - 10
Review Details
|
shoulnd't we also support |
Hi @eapolinario, Thanks for the suggestion! We focus on Supporting |
@@ -42,6 +43,7 @@ def __init__( | |||
name: str, | |||
task_config: T, | |||
task_type="python-task", | |||
image: Optional[Union[str, ImageSpec]] = None, | |||
container_image: Optional[Union[str, ImageSpec]] = 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.
@eapolinario and I were talking about this and we were thinking we might want to put this behind kwargs instead. Could we try that please?
Like delete this line... but leave it in the docs below, maybe move it to the bottom of the params, and check for it explicitly in the code to see if it's set (like kwargs["container_image"]
). This way we can hide it from the user, they don't see it in the IDE etc.
cc @thomasjpfan
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.
put this behind kwargs instead
+1
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.
It's a bit non-standard, but I am okay with hiding it in kwargs
, but keeping it 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.
I've hidden container_image
behind kwargs
and kept it at the bottom of docstring. Thanks a lot!
"Please use image because container_image is deprecated and will be removed in the future." | ||
) | ||
elif container_image is not None: | ||
warnings.warn( |
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.
should we just make this info? warning is a little too annoying I think.
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 feel like this is not annoying enough. DeprecationWarning
does not really show up with default filter warnings. (FutureWarning
would be more annoying)
If we really want users to change their code, then I think warnings should be a bit annoying. Because when we remove this feature, breaking code will be even more annoying.
Add `ImageSpec` to the docstring of the `image` parameter for better clarity. Co-authored-by: Yee Hing Tong <[email protected]>
Code Review Agent Run #3a28a5Actionable Suggestions - 0Review Details
|
1. Put deprecated `container_image` param behind `kwargs` 2. Keep `container_image` at the bottom of docstring Signed-off-by: JiangJiaWei1103 <[email protected]>
Code Review Agent Run #44e3d6Actionable Suggestions - 1
Review Details
|
@JiangJiaWei1103 could you change Also, could you remove Thank you! Let's merge after this last change |
Hi Yee, I’ll get it done this weekend. Thanks for the suggestion! |
Signed-off-by: JiangJiaWei1103 <[email protected]>
1. Remove `container_image` from `@task` and `@overload` to hide it behind `kwargs` 2. Let `image` take precedence for version hash generation Signed-off-by: JiangJiaWei1103 <[email protected]>
Code Review Agent Run #914520Actionable Suggestions - 0Additional Suggestions - 10
Review Details
|
1. Hide `container_image` of `Node`'s `with_override` behind `kwargs` 2. Add validation in `Node`'s `with_override` to enforce `image` over deprecated `container_image` 3. Hide `container_image` of `Promise`'s `with_override` behind `kwargs` Signed-off-by: JiangJiaWei1103 <[email protected]>
Signed-off-by: JiangJiaWei1103 <[email protected]>
Signed-off-by: JiangJiaWei1103 <[email protected]>
Signed-off-by: JiangJiaWei1103 <[email protected]>
Code Review Agent Run #4f136eActionable Suggestions - 1
Review Details
|
@property | ||
def _container_image(self) -> typing.Optional[str]: | ||
"""Deprecated, please use `_image` instead.""" | ||
return self._image |
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.
Consider enhancing the deprecation notice for _container_image
by adding a warning using the warnings
module. This would help users transition to using _image
instead.
Code suggestion
Check the AI-generated fix before applying
@property | |
def _container_image(self) -> typing.Optional[str]: | |
"""Deprecated, please use `_image` instead.""" | |
return self._image | |
def _container_image(self) -> typing.Optional[str]: | |
"""Deprecated, please use `_image` instead.""" | |
warnings.warn("_container_image is deprecated, use _image instead", DeprecationWarning, stacklevel=2) | |
return self._image |
Code Review Run #4f136e
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
The Follow-upsI’m curious to know if it’s also necessary to modify flytekit/flytekit/models/core/workflow.py Lines 615 to 626 in 66d4aed
Thanks! |
Tracking issue
Closes flyteorg/flyte#6140.
Why are the changes needed?
To enhance the user experience, the concept of
container
should be abstracted from flytekit users.What changes were proposed in this pull request?
We propose renaming
container_image
toimage
for both the@task
decorator and thewith_overrides
method. To ensure backward compatibility, we will support both parameters with the following behavior:image
andcontainer_image
are specified: Raise an errorcontainer_image
is used: Warn users about the future deprecationimage
is used: Useimage
directlyIn the future, we can revisit whether modifying the developer-facing code is beneficial when it becomes more relevant.
How was this patch tested?
This patch has been tested using enhanced and newly added unit tests.
Setup process
Run all unit tests using the following command:
Check all the applicable boxes
Related PRs
NA
Docs link
Please refer to flyteorg/flyte#6211
Summary by Bito
This PR implements comprehensive improvements including: 1) renaming 'container_image' parameter to 'image' across Flytekit while maintaining backward compatibility and adding deprecation warnings, 2) enhanced error handling in signal handlers, msgpack processing, and authentication flows, 3) improved type validation for shared memory resources and cache policy handling, and 4) implementation of secure pip argument handling and Kubernetes resource validation.Unit tests added: True
Estimated effort to review (1-5, lower is better): 5