Skip to content

Commit 2a43d9e

Browse files
committed
Revert "prep"
This reverts commit 981c312.
1 parent add2d36 commit 2a43d9e

File tree

1 file changed

+2
-44
lines changed

1 file changed

+2
-44
lines changed

src/codeflare_sdk/utils/generate_yaml.py

+2-44
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
from os import urandom
3131
from base64 import b64encode
3232
from urllib3.util import parse_url
33-
from kubernetes.client.rest import ApiException
3433

3534

3635
def read_template(template):
@@ -308,32 +307,6 @@ def get_default_kueue_name(namespace: str):
308307
"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"
309308
)
310309

311-
# test function
312-
313-
# def _throw_for_no_raycluster( user_yaml: dict,
314-
# output_file_name: str,
315-
# namespace: str,
316-
# local_queue: Optional[str],
317-
# labels: dict,):
318-
# api_instance = client.CustomObjectsApi(api_config_handler())
319-
# print('hello')
320-
# # try:
321-
# # api_instance.list_namespaced_custom_object(
322-
# # group="kueue.x-k8s.io",
323-
# # version="v1",
324-
# # namespace=namespace,
325-
# # plural="localqueues",
326-
# # )
327-
# # except ApiException as e:
328-
# # if e.status == 404:
329-
# # raise RuntimeError(
330-
# # "RayCluster CustomResourceDefinition unavailable contact your administrator."
331-
# # )
332-
# # else:
333-
# # raise RuntimeError(
334-
# # "Failed to get RayCluster CustomResourceDefinition: " + str(e)
335-
# # )
336-
337310

338311
def local_queue_exists(namespace: str, local_queue_name: str):
339312
# get all local queues in the namespace
@@ -368,12 +341,6 @@ def write_components(
368341
os.makedirs(directory_path)
369342

370343
components = user_yaml.get("spec", "resources")["resources"].get("GenericItems")
371-
# check if RayCluster CustomResourceDefinition exists if not throw RuntimeError
372-
# _throw_for_no_raycluster()
373-
# if local_queue is None:
374-
# print(
375-
# "Kueue is not installed or won't be used. The absence of CRDs may lack the necessary functionality."
376-
# )
377344
open(output_file_name, "w").close()
378345
lq_name = local_queue or get_default_kueue_name(namespace)
379346
cluster_labels = labels
@@ -400,31 +367,22 @@ def write_components(
400367
)
401368
print(f"Written to: {output_file_name}")
402369

370+
403371
def load_components(
404372
user_yaml: dict,
405373
name: str,
406374
namespace: str,
407375
local_queue: Optional[str],
408-
labels: dict
376+
labels: dict,
409377
):
410378
component_list = []
411379
components = user_yaml.get("spec", "resources")["resources"].get("GenericItems")
412380
lq_name = local_queue or get_default_kueue_name(namespace)
413381
cluster_labels = labels
414-
<<<<<<< HEAD
415382
if not local_queue_exists(namespace, lq_name):
416383
raise ValueError(
417384
"local_queue provided does not exist or is not in this namespace. Please provide the correct local_queue name in Cluster Configuration"
418385
)
419-
=======
420-
421-
# _throw_for_no_raycluster()
422-
423-
# if local_queue is None:
424-
# print(
425-
# "Kueue is not installed or won't be used. The absence of CRDs may lack the necessary functionality."
426-
# )
427-
>>>>>>> 1d38c8d (prep)
428386
for component in components:
429387
if "generictemplate" in component:
430388
if (

0 commit comments

Comments
 (0)