Skip to content

Commit c237528

Browse files
committed
Adding logs that indicates that the queue label is missing
1 parent 02d8560 commit c237528

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

ray-operator/config/samples/ray-cluster.kai-gpu-sharing.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ spec:
4141
apiVersion: ray.io/v1
4242
kind: RayCluster
4343
metadata:
44-
name: rc-half-gpu
44+
name: raycluster-half-gpu
4545
labels:
4646
kai.scheduler/queue: test
4747
spec:
@@ -72,4 +72,4 @@ spec:
7272
resources:
7373
limits:
7474
cpu: "1"
75-
memory: "2Gi"
75+
memory: "2Gi"

ray-operator/config/samples/ray-cluster.kai-scheduler.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ spec:
4141
apiVersion: ray.io/v1
4242
kind: RayCluster
4343
metadata:
44-
name: ray-sample
44+
name: raycluster-sample
4545
labels:
4646
kai.scheduler/queue: test
4747
spec:

ray-operator/controllers/ray/batchscheduler/kai-scheduler/kai_scheduler.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
corev1 "k8s.io/api/core/v1"
1414
"k8s.io/apimachinery/pkg/runtime"
1515
"k8s.io/client-go/rest"
16+
ctrl "sigs.k8s.io/controller-runtime"
1617
"sigs.k8s.io/controller-runtime/pkg/builder"
1718

1819
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
@@ -35,10 +36,16 @@ func (k *KaiScheduler) DoBatchSchedulingOnSubmission(_ context.Context, _ *rayv1
3536
return nil
3637
}
3738

38-
func (k *KaiScheduler) AddMetadataToPod(_ context.Context, app *rayv1.RayCluster, _ string, pod *corev1.Pod) {
39-
if queue, ok := app.Labels[QueueLabelName]; ok {
39+
func (k *KaiScheduler) AddMetadataToPod(ctx context.Context, app *rayv1.RayCluster, _ string, pod *corev1.Pod) {
40+
queue, ok := app.Labels[QueueLabelName]
41+
if !ok || queue == "" {
42+
logger := ctrl.LoggerFrom(ctx).WithName("kai-scheduler")
43+
logger.Error(nil, "Queue label missing from RayCluster; pods will remain pending",
44+
"requiredLabel", QueueLabelName,
45+
"rayCluster", app.Name)
46+
} else {
4047
if pod.Labels == nil {
41-
pod.Labels = map[string]string{}
48+
pod.Labels = make(map[string]string)
4249
}
4350
pod.Labels[QueueLabelName] = queue
4451
}
@@ -53,5 +60,5 @@ func (kf *KaiSchedulerFactory) AddToScheme(_ *runtime.Scheme) {
5360
}
5461

5562
func (kf *KaiSchedulerFactory) ConfigureReconciler(b *builder.Builder) *builder.Builder {
56-
return b
63+
return b
5764
}

0 commit comments

Comments
 (0)