-
Notifications
You must be signed in to change notification settings - Fork 20
Cmldev 537 implement pcl support for node staging feature #173
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
base: dev
Are you sure you want to change the base?
Cmldev 537 implement pcl support for node staging feature #173
Conversation
| self._state = None | ||
| self._staging_enabled = False | ||
| self._staging_start_remaining = True | ||
| self._staging_abort_on_failure = False |
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.
@marpauli-cisco do we need to have all 3 as standalone properties? I think that we have an object in UI, API and exported topologies. Also, we should call it node_staging even though the name will likely change,
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.
these attributes represent values from data on Lab creation, but we don't use individual setters for all three values, but only one setter for single property node_staging that is a dict containing these three.
| self._state = None | ||
| self._staging_enabled = False | ||
| self._staging_start_remaining = True | ||
| self._staging_abort_on_failure = False |
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.
these attributes represent values from data on Lab creation, but we don't use individual setters for all three values, but only one setter for single property node_staging that is a dict containing these three.
| @property | ||
| def staging_enabled(self) -> bool: | ||
| """Return whether node staging is enabled for the lab.""" | ||
| self.sync_topology_if_outdated() | ||
| return self._staging_enabled | ||
|
|
||
| @staging_enabled.setter | ||
| def staging_enabled(self, value: bool) -> None: | ||
| """Set whether node staging is enabled for the lab.""" | ||
| self._set_staging_property("staging_enabled", value) | ||
|
|
||
| @property | ||
| def staging_start_remaining(self) -> bool: | ||
| """Return whether to start remaining nodes after staged nodes complete.""" | ||
| self.sync_topology_if_outdated() | ||
| return self._staging_start_remaining | ||
|
|
||
| @staging_start_remaining.setter | ||
| def staging_start_remaining(self, value: bool) -> None: | ||
| """Set whether to start remaining nodes after staged nodes complete.""" | ||
| self._set_staging_property("staging_start_remaining", value) | ||
|
|
||
| @property | ||
| def staging_abort_on_failure(self) -> bool: | ||
| """Return whether to abort remaining nodes if a staged node fails.""" | ||
| self.sync_topology_if_outdated() | ||
| return self._staging_abort_on_failure | ||
|
|
||
| @staging_abort_on_failure.setter | ||
| def staging_abort_on_failure(self, value: bool) -> None: | ||
| """Set whether to abort remaining nodes if a staged node fails.""" | ||
| self._set_staging_property("staging_abort_on_failure", value) |
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.
replace these properties and setters with single property node_staging - dict containing these three
| if node_staging: | ||
| self._staging_enabled = node_staging.get("enabled", self._staging_enabled) | ||
| self._staging_start_remaining = node_staging.get( | ||
| "start_remaining", self._staging_start_remaining | ||
| ) | ||
| self._staging_abort_on_failure = node_staging.get( | ||
| "abort_on_failure", self._staging_abort_on_failure | ||
| ) | ||
|
|
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.
| if node_staging: | |
| self._staging_enabled = node_staging.get("enabled", self._staging_enabled) | |
| self._staging_start_remaining = node_staging.get( | |
| "start_remaining", self._staging_start_remaining | |
| ) | |
| self._staging_abort_on_failure = node_staging.get( | |
| "abort_on_failure", self._staging_abort_on_failure | |
| ) |
| staging_enabled: bool | None = None, | ||
| staging_start_remaining: bool | None = None, | ||
| staging_abort_on_failure: bool | None = 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.
| staging_enabled: bool | None = None, | |
| staging_start_remaining: bool | None = None, | |
| staging_abort_on_failure: bool | None = None, | |
| node_staging: dict | None = None, |
| :param staging_enabled: Whether node staging is enabled for the lab. | ||
| :param staging_start_remaining: Whether to start remaining nodes after | ||
| priority nodes complete. | ||
| :param staging_abort_on_failure: Whether to abort startup if any node | ||
| fails to start. |
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.
| :param staging_enabled: Whether node staging is enabled for the lab. | |
| :param staging_start_remaining: Whether to start remaining nodes after | |
| priority nodes complete. | |
| :param staging_abort_on_failure: Whether to abort startup if any node | |
| fails to start. | |
| :param node_staging: Parameter for node staging (enabled, abort_on_failure, start_remainig) |
|
|
||
| node_staging = { | ||
| k: v | ||
| for k, v in { | ||
| "enabled": staging_enabled, | ||
| "start_remaining": staging_start_remaining, | ||
| "abort_on_failure": staging_abort_on_failure, | ||
| }.items() | ||
| if v is not None | ||
| } | ||
|
|
||
| if node_staging: | ||
| body["node_staging"] = node_staging | ||
|
|
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.
| node_staging = { | |
| k: v | |
| for k, v in { | |
| "enabled": staging_enabled, | |
| "start_remaining": staging_start_remaining, | |
| "abort_on_failure": staging_abort_on_failure, | |
| }.items() | |
| if v is not None | |
| } | |
| if node_staging: | |
| body["node_staging"] = node_staging | |
| if node_staging: | |
| body["node_staging"] = node_staging | |
No description provided.