Skip to content

Commit 841f3ed

Browse files
Check for dashboard readiness after cluster is ready
1 parent 2e543ca commit 841f3ed

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/codeflare_sdk/cluster/cluster.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,19 +268,27 @@ def wait_ready(self, timeout: Optional[int] = None):
268268
dashboard_ready = False
269269
status = None
270270
time = 0
271-
while not ready or not dashboard_ready:
271+
while not ready:
272272
status, ready = self.status(print_to_console=False)
273-
dashboard_ready = self.is_dashboard_ready()
274273
if status == CodeFlareClusterStatus.UNKNOWN:
275274
print(
276275
"WARNING: Current cluster status is unknown, have you run cluster.up yet?"
277276
)
278-
if not ready or not dashboard_ready:
277+
if not ready:
278+
if timeout and time >= timeout:
279+
raise TimeoutError(f"wait() timed out after waiting {timeout}s for cluster to be ready")
280+
sleep(5)
281+
time += 5
282+
print("Requested cluster is up and running!")
283+
284+
while not dashboard_ready:
285+
dashboard_ready = self.is_dashboard_ready()
286+
if not dashboard_ready:
279287
if timeout and time >= timeout:
280-
raise TimeoutError(f"wait() timed out after waiting {timeout}s")
288+
raise TimeoutError(f"wait() timed out after waiting {timeout}s for dashboard to be ready")
281289
sleep(5)
282290
time += 5
283-
print("Requested cluster and dashboard are up and running!")
291+
print("Dashboard is ready!")
284292

285293
def details(self, print_to_console: bool = True) -> RayCluster:
286294
cluster = _copy_to_ray(self)

tests/unit_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,7 @@ def test_wait_ready(mocker, capsys):
17881788
captured = capsys.readouterr()
17891789
assert (
17901790
captured.out
1791-
== "Waiting for requested resources to be set up...\nRequested cluster and dashboard are up and running!\n"
1791+
== "Waiting for requested resources to be set up...\nRequested cluster is up and running!\nDashboard is ready!\n"
17921792
)
17931793

17941794

0 commit comments

Comments
 (0)