-
Notifications
You must be signed in to change notification settings - Fork 13
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
Conversation
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 |
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.
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, |
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.
So many options 😄
if isinstance(keep, str): | ||
keep = OpsTest.ModelKeep(keep.lower()) |
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.
map strings into enum values
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!
introduce Enumerations to preserve or destroy various tracked models