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

feat: Add core watcher module #397

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jneo8
Copy link

@jneo8 jneo8 commented Jan 9, 2025

  • Add core watcher module
  • Refactor guests_on_hypervisor

@jneo8 jneo8 force-pushed the feat/add-core-watcher-module branch from 1aadaf1 to 2547e84 Compare January 9, 2025 07:36
@jneo8 jneo8 mentioned this pull request Jan 9, 2025
Copy link

@chanchiwai-ray chanchiwai-ray left a comment

Choose a reason for hiding this comment

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

Some minor suggestions

sunbeam-python/sunbeam/core/openstack_api.py Show resolved Hide resolved
sunbeam-python/sunbeam/core/watcher.py Outdated Show resolved Hide resolved
sunbeam-python/sunbeam/core/watcher.py Outdated Show resolved Hide resolved
@jneo8 jneo8 force-pushed the feat/add-core-watcher-module branch from 9cbea7d to aeb87ba Compare January 10, 2025 08:28
jneo8 added 2 commits January 13, 2025 10:55
- Add core watcher module
- Refactor guests_on_hypervisor
- fix/Read watcher configuration from clusterdb to build watcher client
- doc/Update guests_on_hypervisor func docstring
- doc/Add comment for TIMEOUT and TIMEOUT_INTERVAL variables
@jneo8 jneo8 force-pushed the feat/add-core-watcher-module branch from aeb87ba to 2ed5ac4 Compare January 13, 2025 02:55
sunbeam-python/requirements.txt Outdated Show resolved Hide resolved
LOG.info(f"All Action plan for Audit {audit.uuid} execution successfully")


@timeout_decorator.timeout(TIMEOUT)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Each actionplan corresponds to multiple actions and each action can be migration. If there are more VMs to be migrated, then the actionplan may take more than TIMEOUT i.e., 3 minutes.

Copy link
Author

Choose a reason for hiding this comment

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

The expected behavior is as follows:

  • If the migration times out, the command should fail.
  • When the user re-runs the command, it should fail if any VMs are still migrating, displaying a message indicating that some instances are in the migration process.
  • Once all migration watcher actions are complete, re-running the command should result in success.

jneo8 added 2 commits January 14, 2025 18:02
…her action

- Refactor: Replace timeout decorator by tenacity
- Fix: Raise exception on failed watcher action
Copy link
Collaborator

@hemanthnakkina hemanthnakkina left a comment

Choose a reason for hiding this comment

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

Minor comments inline.

Couple of things to improve upon as separate PRs:

  • Show progress of maintenance actions in cli (similar to how deployment control plane shows during bootstrap command)
  • Return meaningful output at end of maintenance
    For example,
    If maintenance is failed or timed out, list of actions that are completed, actions that are in error state with reason and actions that are still pending.

@@ -98,3 +98,7 @@ min-file-size = 1

[tool.ruff.lint.mccabe]
max-complexity = 15

[[tool.mypy.overrides]]
module = ["watcherclient.*", "timeout_decorator"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

timeout_decorator is not need here


@tenacity.retry(
reraise=True,
stop=tenacity.stop_after_delay(WAIT_TIMEOUT),
Copy link
Collaborator

Choose a reason for hiding this comment

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

As discussed, the WAIT_TIMEOUT should adjust based on number of actions it has to perform. Otherwise user might end up to run sunbeam maintenance command multiple times if there are more instances to migrate.

client: watcher_client.Client, audit: watcher.Audit
) -> list[watcher.Action]:
"""Get list of actions by audit."""
return client.action.list(audit=audit.uuid, detail=True)
Copy link
Collaborator

@hemanthnakkina hemanthnakkina Jan 17, 2025

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants