Skip to content

Conversation

@kryanbeane
Copy link
Owner

No description provided.

@kryanbeane kryanbeane force-pushed the kueue-integration branch 6 times, most recently from a71cd5b to 2c5937b Compare September 11, 2025 14:39
Comment on lines -98 to -148
self.verify_cluster_cleanup(rayjob)

def _wait_for_job_status(
self,
rayjob: RayJob,
expected_status: str,
timeout: int = 30,
) -> bool:
"""Wait for a job to reach a specific deployment status."""
elapsed_time = 0
check_interval = 2

while elapsed_time < timeout:
status = self.job_api.get_job_status(
name=rayjob.name, k8s_namespace=rayjob.namespace
)
if status and status.get("jobDeploymentStatus") == expected_status:
return True

sleep(check_interval)
elapsed_time += check_interval

return False

def verify_cluster_cleanup(self, rayjob: RayJob, timeout: int = 60):
"""Verify that the cluster created by the RayJob has been cleaned up."""
elapsed_time = 0
check_interval = 5
cluster_api = RayClusterApi()

while elapsed_time < timeout:
try:
cluster_info = cluster_api.get_ray_cluster(
name=rayjob.cluster_name, k8s_namespace=rayjob.namespace
)
# Cluster doesn't exist
if cluster_info is None:
return

sleep(check_interval)
elapsed_time += check_interval

except kubernetes.client.rest.ApiException as e:
if e.status == 404:
return
else:
raise e

raise TimeoutError(
f"Cluster '{rayjob.cluster_name}' was not cleaned up within {timeout} seconds"
)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Moved to support.py so they can be reused

@kryanbeane kryanbeane force-pushed the kueue-integration branch 19 times, most recently from e62b274 to 7398069 Compare September 18, 2025 19:01
@kryanbeane kryanbeane force-pushed the kueue-integration branch 4 times, most recently from 344e935 to 274ba47 Compare September 19, 2025 16:43
@kryanbeane kryanbeane force-pushed the kueue-integration branch 19 times, most recently from b89e24d to 22f507d Compare September 30, 2025 11:40
@kryanbeane kryanbeane force-pushed the kueue-integration branch 6 times, most recently from 3f611b6 to 9a22414 Compare October 2, 2025 10:28
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.

2 participants