Skip to content

Commit

Permalink
Added missing attributes to join_existing_lab method.
Browse files Browse the repository at this point in the history
Fixed type annotations for the convergence wait time
  • Loading branch information
tmikuska committed Jan 7, 2025
1 parent 1a49173 commit 1a2a8a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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

0 comments on commit 1a2a8a2

Please sign in to comment.