Skip to content

Commit b3f1fb7

Browse files
committed
update
1 parent 8854cab commit b3f1fb7

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

ray-operator/controllers/ray/rayjob_controller.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -505,10 +505,9 @@ func (r *RayJobReconciler) updateState(ctx context.Context, rayJob *rayv1.RayJob
505505
return nil
506506
}
507507

508-
// TODO: select existing rayclusters by ClusterSelector
509508
func (r *RayJobReconciler) getOrCreateRayClusterInstance(ctx context.Context, rayJobInstance *rayv1.RayJob) (*rayv1.RayCluster, error) {
510509
rayClusterInstanceName := rayJobInstance.Status.RayClusterName
511-
r.Log.V(3).Info("try to find existing RayCluster instance", "name", rayClusterInstanceName)
510+
r.Log.Info("try to find existing RayCluster instance", "name", rayClusterInstanceName)
512511
rayClusterNamespacedName := types.NamespacedName{
513512
Namespace: rayJobInstance.Namespace,
514513
Name: rayClusterInstanceName,
@@ -517,6 +516,7 @@ func (r *RayJobReconciler) getOrCreateRayClusterInstance(ctx context.Context, ra
517516
rayClusterInstance := &rayv1.RayCluster{}
518517
if err := r.Get(ctx, rayClusterNamespacedName, rayClusterInstance); err != nil {
519518
if errors.IsNotFound(err) {
519+
r.Log.Info("RayCluster not found", "RayJob", rayJobInstance.Name, "RayCluster", rayClusterNamespacedName)
520520
// TODO: If both ClusterSelector and RayClusterSpec are not set, we should avoid retrieving a RayCluster instance.
521521
// Consider moving this logic to a more appropriate location.
522522
if len(rayJobInstance.Spec.ClusterSelector) == 0 && rayJobInstance.Spec.RayClusterSpec == nil {
@@ -534,23 +534,19 @@ func (r *RayJobReconciler) getOrCreateRayClusterInstance(ctx context.Context, ra
534534
return nil, nil
535535
}
536536

537-
r.Log.Info("RayCluster not found, creating RayCluster!", "raycluster", rayClusterNamespacedName)
537+
r.Log.Info("RayCluster not found, creating RayCluster!", "RayCluster", rayClusterNamespacedName)
538538
rayClusterInstance, err = r.constructRayClusterForRayJob(rayJobInstance, rayClusterInstanceName)
539539
if err != nil {
540-
r.Log.Error(err, "unable to construct a new rayCluster")
541-
// Error construct the RayCluster object - requeue the request.
540+
r.Log.Error(err, "unable to construct a new RayCluster")
542541
return nil, err
543542
}
544543
if err := r.Create(ctx, rayClusterInstance); err != nil {
545-
r.Log.Error(err, "unable to create rayCluster for rayJob", "rayCluster", rayClusterInstance)
546-
// Error creating the RayCluster object - requeue the request.
544+
r.Log.Error(err, "unable to create RayCluster for RayJob", "RayCluster", rayClusterInstance)
547545
return nil, err
548546
}
549-
r.Log.Info("created rayCluster for rayJob", "rayCluster", rayClusterInstance)
550-
r.Recorder.Eventf(rayJobInstance, corev1.EventTypeNormal, "Created", "Created cluster %s", rayJobInstance.Status.RayClusterName)
547+
r.Recorder.Eventf(rayJobInstance, corev1.EventTypeNormal, "Created", "Created RayCluster %s", rayJobInstance.Status.RayClusterName)
551548
} else {
552549
r.Log.Error(err, "Fail to get RayCluster!")
553-
// Error reading the RayCluster object - requeue the request.
554550
return nil, err
555551
}
556552
}

0 commit comments

Comments
 (0)