Skip to content

Commit ca9ca8c

Browse files
fix-scheduling-spec
1 parent 62bcd51 commit ca9ca8c

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/codeflare_sdk/templates/base-template.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ metadata:
88
orderedinstance: "m4.xlarge_g4dn.xlarge"
99
spec:
1010
priority: 9
11-
schedulingSpec:
12-
minAvailable: 3
1311
resources:
1412
Items: []
1513
GenericItems:

src/codeflare_sdk/utils/generate_yaml.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,19 @@ def update_labels(yaml, instascale, instance_types):
8989
metadata.pop("labels")
9090

9191

92-
def update_priority(item, dispatch_priority):
92+
def update_priority(yaml, item, workers, dispatch_priority):
9393
if dispatch_priority is not None:
9494
head = item.get("generictemplate").get("spec").get("headGroupSpec")
9595
worker = item.get("generictemplate").get("spec").get("workerGroupSpecs")[0]
9696
head["template"]["spec"]["priorityClassName"] = dispatch_priority
9797
worker["template"]["spec"]["priorityClassName"] = dispatch_priority
98+
update_scheduling_spec(yaml, workers)
99+
100+
101+
def update_scheduling_spec(yaml, workers):
102+
spec = yaml.get("spec")
103+
spec["schedulingSpec"] = {"minAvailable": ""}
104+
spec["schedulingSpec"]["minAvailable"] = workers + 1
98105

99106

100107
def update_custompodresources(
@@ -183,11 +190,6 @@ def update_resources(spec, min_cpu, max_cpu, min_memory, max_memory, gpu):
183190
limits["nvidia.com/gpu"] = gpu
184191

185192

186-
def update_scheduling_spec(yaml, workers):
187-
spec = yaml.get("spec")
188-
spec["schedulingSpec"]["minAvailable"] = workers + 1
189-
190-
191193
def update_nodes(
192194
item,
193195
appwrapper_name,
@@ -368,8 +370,7 @@ def generate_appwrapper(
368370
route_item = resources["resources"].get("GenericItems")[1]
369371
update_names(user_yaml, item, appwrapper_name, cluster_name, namespace)
370372
update_labels(user_yaml, instascale, instance_types)
371-
update_priority(item, dispatch_priority)
372-
update_scheduling_spec(user_yaml, workers)
373+
update_priority(user_yaml, item, workers, dispatch_priority)
373374
update_custompodresources(
374375
item, min_cpu, max_cpu, min_memory, max_memory, gpu, workers
375376
)

0 commit comments

Comments
 (0)