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

Fix convergence wait time #128

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions virl2_client/models/lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def __init__(
auto_sync_interval: float = 1.0,
wait: bool = True,
wait_max_iterations: int = 500,
wait_time: int = 5,
wait_time: int | float = 5,
hostname: str | None = None,
resource_pool_manager: ResourcePoolManagement | None = None,
) -> None:
Expand Down Expand Up @@ -1218,7 +1218,7 @@ def wait_until_lab_converged(
max_iter = (
self.wait_max_iterations if max_iterations is None else max_iterations
)
wait_time = self.wait_time if wait_time is None else wait_time
local_wait_time = float(self.wait_time if wait_time is None else wait_time)
_LOGGER.info(f"Waiting for lab {self._id} to converge.")
for index in range(max_iter):
converged = self.has_converged()
Expand All @@ -1230,7 +1230,7 @@ def wait_until_lab_converged(
_LOGGER.info(
f"Lab has not converged, attempt {index}/{max_iter}, waiting..."
)
time.sleep(wait_time)
time.sleep(local_wait_time)

msg = f"Lab {self.id} has not converged, maximum tries {max_iter} exceeded."
_LOGGER.error(msg)
Expand Down
2 changes: 2 additions & 0 deletions virl2_client/virl2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,8 @@ def join_existing_lab(self, lab_id: str, sync_lab: bool = True) -> Lab:
self.password,
auto_sync=self.auto_sync,
auto_sync_interval=self.auto_sync_interval,
wait_max_iterations=self.convergence_wait_max_iter,
wait_time=self.convergence_wait_time,
resource_pool_manager=self.resource_pool_management,
)
if sync_lab:
Expand Down
Loading