Skip to content

Commit ad124ea

Browse files
make priority levels global
1 parent a6d81da commit ad124ea

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/codeflare_sdk/utils/generate_yaml.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,18 @@ def update_labels(yaml, instascale, instance_types):
7676
metadata.pop("labels")
7777

7878

79+
PRIORITY_LEVELS = {
80+
"low": (1, "low-priority"),
81+
"default": (5, "default-priority"),
82+
"high": (10, "high-priority"),
83+
}
84+
85+
7986
def update_priority(yaml, item, priority):
80-
if priority not in ["low", "default", "high"]:
87+
if priority not in PRIORITY_LEVELS:
8188
sys.exit("Priority must be 'low', 'default', or 'high'")
8289

83-
priority_levels = {
84-
"low": (1, "low-priority"),
85-
"default": (5, "default-priority"),
86-
"high": (10, "high-priority"),
87-
}
88-
89-
priority_level = priority_levels[priority]
90+
priority_level = PRIORITY_LEVELS[priority]
9091
spec = yaml.get("spec")
9192
spec["priority"] = priority_level[0]
9293
# spec["SchedulingSpec"]["priorityClassName"] = priority_level

0 commit comments

Comments
 (0)