Skip to content
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

Improvements in keeping or destroying models #127

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

addyess
Copy link
Member

@addyess addyess commented Feb 27, 2024

introduce Enumerations to preserve or destroy various tracked models

Comment on lines -569 to +598
if self._init_keep_model:
return True
current_state = self.current_alias and self._models.get(self.current_alias)
return current_state.keep if current_state else False
return current_state.keep if current_state else self._init_keep_model
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So long as the model exists, track_model will ensure the value of keep is set according to the spec.

If the current_alias is unset or the model isn't found -- fall back to the global flag.

@@ -730,7 +756,7 @@ async def track_model(
model_name: Optional[str] = None,
cloud_name: Optional[str] = None,
use_existing: Optional[bool] = None,
keep: Optional[bool] = None,
keep: Union[ModelKeep, str, bool, None] = ModelKeep.IF_EXISTS,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So many options 😄

Comment on lines +799 to +800
if isinstance(keep, str):
keep = OpsTest.ModelKeep(keep.lower())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map strings into enum values

Copy link
Member

@mateoflorido mateoflorido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@addyess addyess merged commit 49d8c44 into main Feb 27, 2024
6 of 9 checks passed
@addyess addyess deleted the akd/track-models-keep-override branch February 27, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants