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 Jun 21, 2023
1 parent b1d1d16 commit 3c37651
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 @@ -76,17 +76,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 @@ -234,7 +234,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 3c37651

Please sign in to comment.