Skip to content

Commit

Permalink
make priority levels global
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelClifford committed Jul 26, 2023
1 parent 1aefc04 commit a1f084c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
17 changes: 9 additions & 8 deletions src/codeflare_sdk/utils/generate_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,18 @@ def update_labels(yaml, instascale, instance_types):
metadata.pop("labels")


PRIORITY_LEVELS = {
"low": (1, "low-priority"),
"default": (5, "default-priority"),
"high": (10, "high-priority"),
}


def update_priority(yaml, item, priority):
if priority not in ["low", "default", "high"]:
if priority not in PRIORITY_LEVELS:
sys.exit("Priority must be 'low', 'default', or 'high'")

priority_levels = {
"low": (1, "low-priority"),
"default": (5, "default-priority"),
"high": (10, "high-priority"),
}

priority_level = priority_levels[priority]
priority_level = PRIORITY_LEVELS[priority]
spec = yaml.get("spec")
spec["priority"] = priority_level[0]
# spec["SchedulingSpec"]["priorityClassName"] = priority_level
Expand Down
1 change: 0 additions & 1 deletion tests/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ def test_config_creation():

def test_cluster_creation():
cluster = Cluster(test_config_creation())
print(cluster.app_wrapper_yaml)
assert cluster.app_wrapper_yaml == "unit-test-cluster.yaml"
assert cluster.app_wrapper_name == "unit-test-cluster"
assert filecmp.cmp(
Expand Down

0 comments on commit a1f084c

Please sign in to comment.