-
Notifications
You must be signed in to change notification settings - Fork 309
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
Flytekit remote updates for notebooks and versions #3109
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Ketan Umare <[email protected]>
Code Review Agent Run #7eedadActionable Suggestions - 1
Additional Suggestions - 1
Review Details
|
Changelist by BitoThis pull request implements the following key changes.
|
def _resolve_version( | ||
self, version: typing.Optional[str], entity: typing.Any, ss: SerializationSettings | ||
) -> typing.Tuple[str, typing.Optional[PickledEntity]]: | ||
if version is None and self.interactive_mode_enabled: | ||
md5_bytes, pickled_target_dict = _get_pickled_target_dict(entity) | ||
return self._version_from_hash( | ||
md5_bytes, ss, entity.python_interface.default_inputs_as_kwargs, *self._get_image_names(entity) | ||
), pickled_target_dict | ||
elif version is not None: | ||
return version, None | ||
raise ValueError( | ||
"Version must be provided when not in interactive mode. If you want to use latest version pass 'latest'" | ||
) |
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 extracting the version resolution logic into a separate method for better code organization. The _resolve_version
method currently handles both version resolution and pickled entity management, which could be split for better maintainability.
Code suggestion
Check the AI-generated fix before applying
def _resolve_version( | |
self, version: typing.Optional[str], entity: typing.Any, ss: SerializationSettings | |
) -> typing.Tuple[str, typing.Optional[PickledEntity]]: | |
if version is None and self.interactive_mode_enabled: | |
md5_bytes, pickled_target_dict = _get_pickled_target_dict(entity) | |
return self._version_from_hash( | |
md5_bytes, ss, entity.python_interface.default_inputs_as_kwargs, *self._get_image_names(entity) | |
), pickled_target_dict | |
elif version is not None: | |
return version, None | |
raise ValueError( | |
"Version must be provided when not in interactive mode. If you want to use latest version pass 'latest'" | |
) | |
def _get_pickled_entity(self, entity: typing.Any) -> typing.Optional[PickledEntity]: | |
if not self.interactive_mode_enabled: | |
return None | |
md5_bytes, pickled_target_dict = _get_pickled_target_dict(entity) | |
return pickled_target_dict | |
def _resolve_version( | |
self, version: typing.Optional[str], entity: typing.Any, ss: SerializationSettings | |
) -> typing.Tuple[str, typing.Optional[PickledEntity]]: | |
if version is not None: | |
return version, None | |
if not self.interactive_mode_enabled: | |
raise ValueError( | |
"Version must be provided when not in interactive mode. If you want to use latest version pass 'latest'" | |
) | |
md5_bytes, pickled_target_dict = _get_pickled_target_dict(entity) | |
version = self._version_from_hash( | |
md5_bytes, ss, entity.python_interface.default_inputs_as_kwargs, *self._get_image_names(entity) | |
) | |
return version, pickled_target_dict |
Code Review Run #7eedad
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
Problems:
latest
as a special versionExample cases, now works
Summary by Bito
This PR implements standardized version handling in Flytekit's remote operations, introducing 'latest' as the default version option. The changes include a new _resolve_version method for consistent version resolution and improved registration process across interactive and non-interactive modes. The update enhances error messaging and version handling documentation.Unit tests added: False
Estimated effort to review (1-5, lower is better): 2