Skip to content

Commit

Permalink
Revert "prep"
Browse files Browse the repository at this point in the history
This reverts commit 981c312.
  • Loading branch information
Fiona-Waters committed May 28, 2024
1 parent add2d36 commit 2a43d9e
Showing 1 changed file with 2 additions and 44 deletions.
46 changes: 2 additions & 44 deletions src/codeflare_sdk/utils/generate_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from os import urandom
from base64 import b64encode
from urllib3.util import parse_url
from kubernetes.client.rest import ApiException


def read_template(template):
Expand Down Expand Up @@ -308,32 +307,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 @@ -368,12 +341,6 @@ def write_components(
os.makedirs(directory_path)

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."
# )
open(output_file_name, "w").close()
lq_name = local_queue or get_default_kueue_name(namespace)
cluster_labels = labels
Expand All @@ -400,31 +367,22 @@ def write_components(
)
print(f"Written to: {output_file_name}")


def load_components(
user_yaml: dict,
name: str,
namespace: str,
local_queue: Optional[str],
labels: dict
labels: dict,
):
component_list = []
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)
for component in components:
if "generictemplate" in component:
if (
Expand Down

0 comments on commit 2a43d9e

Please sign in to comment.