Skip to content

Commit

Permalink
improve isClusterActive logic
Browse files Browse the repository at this point in the history
Signed-off-by: Yicheng-Lu-llll <luyc58576@gmail.com>
  • Loading branch information
Yicheng-Lu-llll committed Oct 13, 2024
1 parent fdda623 commit d292656
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,18 @@ func isClusterActive(c rayclusterv1.RayCluster) bool {
return false
}

// Case 2: Ray Pod creation or deletion failed
isRayPodCreateOrDeleteFailed := meta.IsStatusConditionPresentAndEqual(c.Status.Conditions, string(rayclusterv1.RayClusterReplicaFailure), metav1.ConditionTrue)
if isRayPodCreateOrDeleteFailed {
return false
}

// Case 3: The RayCluster has not been provisioned yet.
// Case 2: The RayCluster has not been provisioned yet.
// This means the RayCluster is in the init stage, waiting for all Ray Pods to become ready for the first time.
// We consider the RayCluster active, as the ReplicaSet also counts Pods that are in the init stage.
isRayClusterProvisioned := meta.IsStatusConditionPresentAndEqual(c.Status.Conditions, string(rayclusterv1.RayClusterProvisioned), metav1.ConditionTrue)
if !isRayClusterProvisioned {
return true
}

// Case 3: The RayCluster has been provisioned, but Ray Pod creation or deletion failed afterward.
isRayPodCreateOrDeleteFailed := meta.IsStatusConditionPresentAndEqual(c.Status.Conditions, string(rayclusterv1.RayClusterReplicaFailure), metav1.ConditionTrue)
if isRayPodCreateOrDeleteFailed {
return false
}

// Case 4: The RayCluster has been provisioned and we need to check if it is ready.
Expand Down

0 comments on commit d292656

Please sign in to comment.