Skip to content

Commit 477d7f9

Browse files
fix-scheduling-spec
1 parent 89e6c5b commit 477d7f9

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-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

+7-8
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,18 @@ 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)
9899

100+
def update_scheduling_spec(yaml, workers):
101+
spec = yaml.get("spec")
102+
spec["schedulingSpec"]={"minAvailable":""}
103+
spec["schedulingSpec"]["minAvailable"] = workers + 1
99104

100105
def update_custompodresources(
101106
item, min_cpu, max_cpu, min_memory, max_memory, gpu, workers
@@ -183,11 +188,6 @@ def update_resources(spec, min_cpu, max_cpu, min_memory, max_memory, gpu):
183188
limits["nvidia.com/gpu"] = gpu
184189

185190

186-
def update_scheduling_spec(yaml, workers):
187-
spec = yaml.get("spec")
188-
spec["schedulingSpec"]["minAvailable"] = workers + 1
189-
190-
191191
def update_nodes(
192192
item,
193193
appwrapper_name,
@@ -368,8 +368,7 @@ def generate_appwrapper(
368368
route_item = resources["resources"].get("GenericItems")[1]
369369
update_names(user_yaml, item, appwrapper_name, cluster_name, namespace)
370370
update_labels(user_yaml, instascale, instance_types)
371-
update_priority(item, dispatch_priority)
372-
update_scheduling_spec(user_yaml, workers)
371+
update_priority(user_yaml, item, workers, dispatch_priority)
373372
update_custompodresources(
374373
item, min_cpu, max_cpu, min_memory, max_memory, gpu, workers
375374
)

0 commit comments

Comments
 (0)