Skip to content

Commit 47c0093

Browse files
Check for dashboard readiness after cluster is ready
1 parent 54a5a12 commit 47c0093

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/codeflare_sdk/cluster/cluster.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -274,19 +274,27 @@ def wait_ready(self, timeout: Optional[int] = None):
274274
dashboard_ready = False
275275
status = None
276276
time = 0
277-
while not ready or not dashboard_ready:
277+
while not ready:
278278
status, ready = self.status(print_to_console=False)
279-
dashboard_ready = self.is_dashboard_ready()
280279
if status == CodeFlareClusterStatus.UNKNOWN:
281280
print(
282281
"WARNING: Current cluster status is unknown, have you run cluster.up yet?"
283282
)
284-
if not ready or not dashboard_ready:
283+
if not ready:
284+
if timeout and time >= timeout:
285+
raise TimeoutError(f"wait() timed out after waiting {timeout}s for cluster to be ready")
286+
sleep(5)
287+
time += 5
288+
print("Requested cluster is up and running!")
289+
290+
while not dashboard_ready:
291+
dashboard_ready = self.is_dashboard_ready()
292+
if not dashboard_ready:
285293
if timeout and time >= timeout:
286-
raise TimeoutError(f"wait() timed out after waiting {timeout}s")
294+
raise TimeoutError(f"wait() timed out after waiting {timeout}s for dashboard to be ready")
287295
sleep(5)
288296
time += 5
289-
print("Requested cluster and dashboard are up and running!")
297+
print("Dashboard is ready!")
290298

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

tests/unit_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1794,7 +1794,7 @@ def test_wait_ready(mocker, capsys):
17941794
captured = capsys.readouterr()
17951795
assert (
17961796
captured.out
1797-
== "Waiting for requested resources to be set up...\nRequested cluster and dashboard are up and running!\n"
1797+
== "Waiting for requested resources to be set up...\nRequested cluster is up and running!\nDashboard is ready!\n"
17981798
)
17991799

18001800

0 commit comments

Comments
 (0)