From 23f464a4d2ca103b2e5b9a1412325111284c2fde Mon Sep 17 00:00:00 2001 From: MichaelClifford Date: Fri, 16 Jun 2023 17:17:39 -0400 Subject: [PATCH] make priority levels global --- src/codeflare_sdk/utils/generate_yaml.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/codeflare_sdk/utils/generate_yaml.py b/src/codeflare_sdk/utils/generate_yaml.py index e5389cca4..5e2e7cb4e 100755 --- a/src/codeflare_sdk/utils/generate_yaml.py +++ b/src/codeflare_sdk/utils/generate_yaml.py @@ -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