@@ -505,10 +505,9 @@ func (r *RayJobReconciler) updateState(ctx context.Context, rayJob *rayv1.RayJob
505
505
return nil
506
506
}
507
507
508
- // TODO: select existing rayclusters by ClusterSelector
509
508
func (r * RayJobReconciler ) getOrCreateRayClusterInstance (ctx context.Context , rayJobInstance * rayv1.RayJob ) (* rayv1.RayCluster , error ) {
510
509
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 )
512
511
rayClusterNamespacedName := types.NamespacedName {
513
512
Namespace : rayJobInstance .Namespace ,
514
513
Name : rayClusterInstanceName ,
@@ -517,6 +516,7 @@ func (r *RayJobReconciler) getOrCreateRayClusterInstance(ctx context.Context, ra
517
516
rayClusterInstance := & rayv1.RayCluster {}
518
517
if err := r .Get (ctx , rayClusterNamespacedName , rayClusterInstance ); err != nil {
519
518
if errors .IsNotFound (err ) {
519
+ r .Log .Info ("RayCluster not found" , "RayJob" , rayJobInstance .Name , "RayCluster" , rayClusterNamespacedName )
520
520
// TODO: If both ClusterSelector and RayClusterSpec are not set, we should avoid retrieving a RayCluster instance.
521
521
// Consider moving this logic to a more appropriate location.
522
522
if len (rayJobInstance .Spec .ClusterSelector ) == 0 && rayJobInstance .Spec .RayClusterSpec == nil {
@@ -534,23 +534,19 @@ func (r *RayJobReconciler) getOrCreateRayClusterInstance(ctx context.Context, ra
534
534
return nil , nil
535
535
}
536
536
537
- r .Log .Info ("RayCluster not found, creating RayCluster!" , "raycluster " , rayClusterNamespacedName )
537
+ r .Log .Info ("RayCluster not found, creating RayCluster!" , "RayCluster " , rayClusterNamespacedName )
538
538
rayClusterInstance , err = r .constructRayClusterForRayJob (rayJobInstance , rayClusterInstanceName )
539
539
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" )
542
541
return nil , err
543
542
}
544
543
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 )
547
545
return nil , err
548
546
}
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 )
551
548
} else {
552
549
r .Log .Error (err , "Fail to get RayCluster!" )
553
- // Error reading the RayCluster object - requeue the request.
554
550
return nil , err
555
551
}
556
552
}
0 commit comments