Skip to content

Commit a1f084c

Browse files
make priority levels global
1 parent 1aefc04 commit a1f084c

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
@@ -88,17 +88,18 @@ def update_labels(yaml, instascale, instance_types):
8888
metadata.pop("labels")
8989

9090

91+
PRIORITY_LEVELS = {
92+
"low": (1, "low-priority"),
93+
"default": (5, "default-priority"),
94+
"high": (10, "high-priority"),
95+
}
96+
97+
9198
def update_priority(yaml, item, priority):
92-
if priority not in ["low", "default", "high"]:
99+
if priority not in PRIORITY_LEVELS:
93100
sys.exit("Priority must be 'low', 'default', or 'high'")
94101

95-
priority_levels = {
96-
"low": (1, "low-priority"),
97-
"default": (5, "default-priority"),
98-
"high": (10, "high-priority"),
99-
}
100-
101-
priority_level = priority_levels[priority]
102+
priority_level = PRIORITY_LEVELS[priority]
102103
spec = yaml.get("spec")
103104
spec["priority"] = priority_level[0]
104105
# spec["SchedulingSpec"]["priorityClassName"] = priority_level

tests/unit_test.py

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

203203
def test_cluster_creation():
204204
cluster = Cluster(test_config_creation())
205-
print(cluster.app_wrapper_yaml)
206205
assert cluster.app_wrapper_yaml == "unit-test-cluster.yaml"
207206
assert cluster.app_wrapper_name == "unit-test-cluster"
208207
assert filecmp.cmp(

0 commit comments

Comments
 (0)