Skip to content

Commit

Permalink
Move priority flag check to common place
Browse files Browse the repository at this point in the history
  • Loading branch information
mszadkow committed Oct 14, 2024
1 parent 22ca30f commit 3642517
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 19 deletions.
4 changes: 4 additions & 0 deletions cmd/experimental/kjobctl/pkg/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,10 @@ func (b *Builder) buildObjectMeta(templateObjectMeta metav1.ObjectMeta) metav1.O
objectMeta.Labels[kueueconstants.QueueLabel] = b.localQueue
}

if len(b.priority) != 0 {
objectMeta.Labels[kueueconstants.WorkloadPriorityClassLabel] = b.priority
}

return objectMeta
}

Expand Down
5 changes: 0 additions & 5 deletions cmd/experimental/kjobctl/pkg/builder/job_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
batchv1 "k8s.io/api/batch/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

type jobBuilder struct {
Expand All @@ -49,10 +48,6 @@ func (b *jobBuilder) build(ctx context.Context) (runtime.Object, []runtime.Objec

job.Spec.Template.Spec = b.buildPodSpec(job.Spec.Template.Spec)

if len(b.priority) != 0 {
job.Labels[kueueconstants.WorkloadPriorityClassLabel] = b.priority
}

if b.parallelism != nil {
job.Spec.Parallelism = b.parallelism
}
Expand Down
5 changes: 0 additions & 5 deletions cmd/experimental/kjobctl/pkg/builder/ray_cluster_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

type rayClusterBuilder struct {
Expand All @@ -47,10 +46,6 @@ func (b *rayClusterBuilder) build(ctx context.Context) (runtime.Object, []runtim
Spec: template.Template.Spec,
}

if len(b.priority) != 0 {
rayCluster.Labels[kueueconstants.WorkloadPriorityClassLabel] = b.priority
}

b.buildRayClusterSpec(&rayCluster.Spec)

return rayCluster, nil, nil
Expand Down
4 changes: 0 additions & 4 deletions cmd/experimental/kjobctl/pkg/builder/ray_job_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ func (b *rayJobBuilder) build(ctx context.Context) (runtime.Object, []runtime.Ob
rayJob.Spec.Entrypoint = strings.Join(b.command, " ")
}

if len(b.priority) != 0 {
rayJob.Labels[kueueconstants.WorkloadPriorityClassLabel] = b.priority
}

if len(b.rayCluster) != 0 {
delete(rayJob.ObjectMeta.Labels, kueueconstants.QueueLabel)
rayJob.Spec.RayClusterSpec = nil
Expand Down
5 changes: 0 additions & 5 deletions cmd/experimental/kjobctl/pkg/builder/slurm_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"
utilrand "k8s.io/apimachinery/pkg/util/rand"
"k8s.io/utils/ptr"
kueue "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/parser"
Expand Down Expand Up @@ -232,10 +231,6 @@ func (b *slurmBuilder) build(ctx context.Context) (runtime.Object, []runtime.Obj
job.Spec.CompletionMode = ptr.To(batchv1.IndexedCompletion)
job.Spec.Template.Spec.Subdomain = b.objectName

if len(b.priority) != 0 {
job.Labels[kueue.WorkloadPriorityClassLabel] = b.priority
}

b.buildPodSpecVolumesAndEnv(&job.Spec.Template.Spec)
job.Spec.Template.Spec.Volumes = append(job.Spec.Template.Spec.Volumes,
corev1.Volume{
Expand Down
Binary file modified cmd/experimental/kjobctl/pkg/cmd/printcrds/embed/manifest.gz
Binary file not shown.

0 comments on commit 3642517

Please sign in to comment.