Skip to content

Commit 3c37651

Browse files
make priority levels global
1 parent b1d1d16 commit 3c37651

File tree

2 files changed

+9
-9
lines changed

2 files changed

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

tests/unit_test.py

-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ def test_config_creation():
234234

235235
def test_cluster_creation():
236236
cluster = Cluster(test_config_creation())
237-
print(cluster.app_wrapper_yaml)
238237
assert cluster.app_wrapper_yaml == "unit-test-cluster.yaml"
239238
assert cluster.app_wrapper_name == "unit-test-cluster"
240239
assert filecmp.cmp(

0 commit comments

Comments
 (0)