Skip to content

Commit 86c2e7e

Browse files
committed
address feedback
1 parent f94acfa commit 86c2e7e

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

src/codeflare_sdk/utils/generate_yaml.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -380,31 +380,30 @@ def load_components(
380380
components = user_yaml.get("spec", "resources")["resources"].get("GenericItems")
381381
lq_name = local_queue or get_default_kueue_name(namespace)
382382
cluster_labels = labels
383-
if local_queue_exists(namespace, lq_name):
384-
for component in components:
385-
if "generictemplate" in component:
386-
if (
387-
"workload.codeflare.dev/appwrapper"
388-
in component["generictemplate"]["metadata"]["labels"]
389-
):
390-
del component["generictemplate"]["metadata"]["labels"][
391-
"workload.codeflare.dev/appwrapper"
392-
]
393-
labels = component["generictemplate"]["metadata"]["labels"]
394-
labels.update({"kueue.x-k8s.io/queue-name": lq_name})
395-
labels.update(cluster_labels)
396-
component_list.append(component["generictemplate"])
397-
398-
resources = "---\n" + "---\n".join(
399-
[yaml.dump(component) for component in component_list]
400-
)
401-
user_yaml = resources
402-
print(f"Yaml resources loaded for {name}")
403-
return user_yaml
404-
else:
383+
if not local_queue_exists(namespace, lq_name):
405384
raise ValueError(
406-
"local_queue provided does not exist. Please provide the correct local_queue name in Cluster Configuration"
385+
"local_queue provided does not exist or is not in this namespace. Please provide the correct local_queue name in Cluster Configuration"
407386
)
387+
for component in components:
388+
if "generictemplate" in component:
389+
if (
390+
"workload.codeflare.dev/appwrapper"
391+
in component["generictemplate"]["metadata"]["labels"]
392+
):
393+
del component["generictemplate"]["metadata"]["labels"][
394+
"workload.codeflare.dev/appwrapper"
395+
]
396+
labels = component["generictemplate"]["metadata"]["labels"]
397+
labels.update({"kueue.x-k8s.io/queue-name": lq_name})
398+
labels.update(cluster_labels)
399+
component_list.append(component["generictemplate"])
400+
401+
resources = "---\n" + "---\n".join(
402+
[yaml.dump(component) for component in component_list]
403+
)
404+
user_yaml = resources
405+
print(f"Yaml resources loaded for {name}")
406+
return user_yaml
408407

409408

410409
def load_appwrapper(user_yaml: dict, name: str):

0 commit comments

Comments
 (0)