Skip to content

Commit

Permalink
prep
Browse files Browse the repository at this point in the history
  • Loading branch information
oksanabaza committed May 28, 2024
1 parent 981c312 commit 5ad68e2
Showing 1 changed file with 8 additions and 37 deletions.
45 changes: 8 additions & 37 deletions src/codeflare_sdk/utils/generate_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,32 +308,6 @@ def get_default_kueue_name(namespace: str):
"Default Local Queue with kueue.x-k8s.io/default-queue: true annotation not found please create a default Local Queue or provide the local_queue name in Cluster Configuration"
)

# test function

# def _throw_for_no_raycluster( user_yaml: dict,
# output_file_name: str,
# namespace: str,
# local_queue: Optional[str],
# labels: dict,):
# api_instance = client.CustomObjectsApi(api_config_handler())
# print('hello')
# # try:
# # api_instance.list_namespaced_custom_object(
# # group="kueue.x-k8s.io",
# # version="v1",
# # namespace=namespace,
# # plural="localqueues",
# # )
# # except ApiException as e:
# # if e.status == 404:
# # raise RuntimeError(
# # "RayCluster CustomResourceDefinition unavailable contact your administrator."
# # )
# # else:
# # raise RuntimeError(
# # "Failed to get RayCluster CustomResourceDefinition: " + str(e)
# # )


def local_queue_exists(namespace: str, local_queue_name: str):
# get all local queues in the namespace
Expand Down Expand Up @@ -370,10 +344,10 @@ def write_components(
components = user_yaml.get("spec", "resources")["resources"].get("GenericItems")
# check if RayCluster CustomResourceDefinition exists if not throw RuntimeError
# _throw_for_no_raycluster()
# if local_queue is None:
# print(
# "Kueue is not installed or won't be used. The absence of CRDs may lack the necessary functionality."
# )
if local_queue is None:
print(
"Kueue is not installed or won't be used. The absence of CRDs may lack the necessary functionality."
)
open(output_file_name, "w").close()
lq_name = local_queue or get_default_kueue_name(namespace)
cluster_labels = labels
Expand Down Expand Up @@ -411,20 +385,17 @@ def load_components(
components = user_yaml.get("spec", "resources")["resources"].get("GenericItems")
lq_name = local_queue or get_default_kueue_name(namespace)
cluster_labels = labels
<<<<<<< HEAD
if not local_queue_exists(namespace, lq_name):
raise ValueError(
"local_queue provided does not exist or is not in this namespace. Please provide the correct local_queue name in Cluster Configuration"
)
=======

# _throw_for_no_raycluster()

# if local_queue is None:
# print(
# "Kueue is not installed or won't be used. The absence of CRDs may lack the necessary functionality."
# )
>>>>>>> 1d38c8d (prep)
if local_queue is None:
print(
"Kueue is not installed or won't be used. The absence of CRDs may lack the necessary functionality."
)
for component in components:
if "generictemplate" in component:
if (
Expand Down

0 comments on commit 5ad68e2

Please sign in to comment.