diff --git a/docs/detailed-documentation/cluster/auth.html b/docs/detailed-documentation/cluster/auth.html index f1d8ad00..be649e78 100644 --- a/docs/detailed-documentation/cluster/auth.html +++ b/docs/detailed-documentation/cluster/auth.html @@ -152,9 +152,8 @@

Module codeflare_sdk.cluster.auth

client.AuthenticationApi(api_client).get_api_group() config_path = None return "Logged into %s" % self.server - except client.ApiException: # pragma: no cover - api_client = None - print("Authentication Error please provide the correct token + server") + except client.ApiException as e: + _kube_api_error_handling(e) def logout(self) -> str: """ @@ -580,9 +579,8 @@

Methods

client.AuthenticationApi(api_client).get_api_group() config_path = None return "Logged into %s" % self.server - except client.ApiException: # pragma: no cover - api_client = None - print("Authentication Error please provide the correct token + server") + except client.ApiException as e: + _kube_api_error_handling(e) def logout(self) -> str: """ @@ -637,9 +635,8 @@

Methods

client.AuthenticationApi(api_client).get_api_group() config_path = None return "Logged into %s" % self.server - except client.ApiException: # pragma: no cover - api_client = None - print("Authentication Error please provide the correct token + server") + except client.ApiException as e: + _kube_api_error_handling(e)
diff --git a/docs/detailed-documentation/cluster/cluster.html b/docs/detailed-documentation/cluster/cluster.html index 3c91c6a6..07e44e4b 100644 --- a/docs/detailed-documentation/cluster/cluster.html +++ b/docs/detailed-documentation/cluster/cluster.html @@ -589,7 +589,7 @@

Module codeflare_sdk.cluster.cluster

if resource["kind"] == "RayCluster": api_instance.create_namespaced_custom_object( group="ray.io", - version="v1alpha1", + version="v1", namespace=namespace, plural="rayclusters", body=resource, @@ -626,7 +626,7 @@

Module codeflare_sdk.cluster.cluster

if resource["kind"] == "RayCluster": api_instance.delete_namespaced_custom_object( group="ray.io", - version="v1alpha1", + version="v1", namespace=namespace, plural="rayclusters", name=self.app_wrapper_name, @@ -713,7 +713,7 @@

Module codeflare_sdk.cluster.cluster

api_instance = client.CustomObjectsApi(api_config_handler()) rcs = api_instance.list_namespaced_custom_object( group="ray.io", - version="v1alpha1", + version="v1", namespace=namespace, plural="rayclusters", ) @@ -870,7 +870,7 @@

Module codeflare_sdk.cluster.cluster

api_instance = client.CustomObjectsApi(api_config_handler()) rcs = api_instance.list_namespaced_custom_object( group="ray.io", - version="v1alpha1", + version="v1", namespace=namespace, plural="rayclusters", ) @@ -890,7 +890,7 @@

Module codeflare_sdk.cluster.cluster

api_instance = client.CustomObjectsApi(api_config_handler()) rcs = api_instance.list_namespaced_custom_object( group="ray.io", - version="v1alpha1", + version="v1", namespace=namespace, plural="rayclusters", ) @@ -934,25 +934,47 @@

Module codeflare_sdk.cluster.cluster

status = RayClusterStatus(rc["status"]["state"].lower()) else: status = RayClusterStatus.UNKNOWN - try: - config_check() - api_instance = client.NetworkingV1Api(api_config_handler()) - ingresses = api_instance.list_namespaced_ingress(rc["metadata"]["namespace"]) - except Exception as e: # pragma no cover - return _kube_api_error_handling(e) - ray_ingress = None - for ingress in ingresses.items: - annotations = ingress.metadata.annotations - protocol = "http" - if ( - ingress.metadata.name == f"ray-dashboard-{rc['metadata']['name']}" - or ingress.metadata.name.startswith(f"{rc['metadata']['name']}-ingress") - ): - if annotations == None: - protocol = "http" - elif "route.openshift.io/termination" in annotations: - protocol = "https" - ray_ingress = f"{protocol}://{ingress.spec.rules[0].host}" + config_check() + dashboard_url = None + if is_openshift_cluster(): + try: + api_instance = client.CustomObjectsApi(api_config_handler()) + routes = api_instance.list_namespaced_custom_object( + group="route.openshift.io", + version="v1", + namespace=rc["metadata"]["namespace"], + plural="routes", + ) + except Exception as e: # pragma: no cover + return _kube_api_error_handling(e) + + for route in routes["items"]: + rc_name = rc["metadata"]["name"] + if route["metadata"]["name"] == f"ray-dashboard-{rc_name}" or route[ + "metadata" + ]["name"].startswith(f"{rc_name}-ingress"): + protocol = "https" if route["spec"].get("tls") else "http" + dashboard_url = f"{protocol}://{route['spec']['host']}" + else: + try: + api_instance = client.NetworkingV1Api(api_config_handler()) + ingresses = api_instance.list_namespaced_ingress( + rc["metadata"]["namespace"] + ) + except Exception as e: # pragma no cover + return _kube_api_error_handling(e) + for ingress in ingresses.items: + annotations = ingress.metadata.annotations + protocol = "http" + if ( + ingress.metadata.name == f"ray-dashboard-{rc['metadata']['name']}" + or ingress.metadata.name.startswith(f"{rc['metadata']['name']}-ingress") + ): + if annotations == None: + protocol = "http" + elif "route.openshift.io/termination" in annotations: + protocol = "https" + dashboard_url = f"{protocol}://{ingress.spec.rules[0].host}" return RayCluster( name=rc["metadata"]["name"], @@ -979,7 +1001,7 @@

Module codeflare_sdk.cluster.cluster

head_gpu=rc["spec"]["headGroupSpec"]["template"]["spec"]["containers"][0][ "resources" ]["limits"]["nvidia.com/gpu"], - dashboard=ray_ingress, + dashboard=dashboard_url, ) @@ -1068,7 +1090,7 @@

Functions

api_instance = client.CustomObjectsApi(api_config_handler()) rcs = api_instance.list_namespaced_custom_object( group="ray.io", - version="v1alpha1", + version="v1", namespace=namespace, plural="rayclusters", ) @@ -1777,7 +1799,7 @@

Classes

if resource["kind"] == "RayCluster": api_instance.create_namespaced_custom_object( group="ray.io", - version="v1alpha1", + version="v1", namespace=namespace, plural="rayclusters", body=resource, @@ -1814,7 +1836,7 @@

Classes

if resource["kind"] == "RayCluster": api_instance.delete_namespaced_custom_object( group="ray.io", - version="v1alpha1", + version="v1", namespace=namespace, plural="rayclusters", name=self.app_wrapper_name, diff --git a/docs/detailed-documentation/cluster/index.html b/docs/detailed-documentation/cluster/index.html index a6027e6f..8454c875 100644 --- a/docs/detailed-documentation/cluster/index.html +++ b/docs/detailed-documentation/cluster/index.html @@ -22,6 +22,29 @@

Module codeflare_sdk.cluster

+
+ +Expand source code + +
from .auth import (
+    Authentication,
+    KubeConfiguration,
+    TokenAuthentication,
+    KubeConfigFileAuthentication,
+)
+
+from .model import (
+    RayClusterStatus,
+    AppWrapperStatus,
+    CodeFlareClusterStatus,
+    RayCluster,
+    AppWrapper,
+)
+
+from .cluster import Cluster, ClusterConfiguration
+
+from .awload import AWManager
+

Sub-modules

diff --git a/docs/detailed-documentation/cluster/model.html b/docs/detailed-documentation/cluster/model.html index 3832494e..ff8a0071 100644 --- a/docs/detailed-documentation/cluster/model.html +++ b/docs/detailed-documentation/cluster/model.html @@ -60,7 +60,7 @@

Module codeflare_sdk.cluster.model

Defines the possible reportable states of a Ray cluster. """ - # https://github.com/ray-project/kuberay/blob/master/ray-operator/apis/ray/v1alpha1/raycluster_types.go#L95 + # https://github.com/ray-project/kuberay/blob/master/ray-operator/apis/ray/v1/raycluster_types.go#L112-L117 READY = "ready" UNHEALTHY = "unhealthy" FAILED = "failed" @@ -383,7 +383,7 @@

Class variables

Defines the possible reportable states of a Ray cluster. """ - # https://github.com/ray-project/kuberay/blob/master/ray-operator/apis/ray/v1alpha1/raycluster_types.go#L95 + # https://github.com/ray-project/kuberay/blob/master/ray-operator/apis/ray/v1/raycluster_types.go#L112-L117 READY = "ready" UNHEALTHY = "unhealthy" FAILED = "failed" diff --git a/docs/detailed-documentation/index.html b/docs/detailed-documentation/index.html index bd408f76..4895f0a9 100644 --- a/docs/detailed-documentation/index.html +++ b/docs/detailed-documentation/index.html @@ -22,6 +22,29 @@

Package codeflare_sdk

+
+ +Expand source code + +
from .cluster import (
+    Authentication,
+    KubeConfiguration,
+    TokenAuthentication,
+    KubeConfigFileAuthentication,
+    AWManager,
+    Cluster,
+    ClusterConfiguration,
+    RayClusterStatus,
+    AppWrapperStatus,
+    CodeFlareClusterStatus,
+    RayCluster,
+    AppWrapper,
+)
+
+from .job import JobDefinition, Job, DDPJobDefinition, DDPJob, RayJobClient
+
+from .utils import generate_cert
+

Sub-modules

diff --git a/docs/detailed-documentation/job/index.html b/docs/detailed-documentation/job/index.html index f4bfe93f..514cb895 100644 --- a/docs/detailed-documentation/job/index.html +++ b/docs/detailed-documentation/job/index.html @@ -22,6 +22,14 @@

Module codeflare_sdk.job

+
+ +Expand source code + +
from .jobs import JobDefinition, Job, DDPJobDefinition, DDPJob
+
+from .ray_jobs import RayJobClient
+

Sub-modules

diff --git a/docs/detailed-documentation/utils/generate_yaml.html b/docs/detailed-documentation/utils/generate_yaml.html index 91f4bab1..c2643556 100644 --- a/docs/detailed-documentation/utils/generate_yaml.html +++ b/docs/detailed-documentation/utils/generate_yaml.html @@ -650,6 +650,11 @@

Module codeflare_sdk.utils.generate_yaml

def write_components(user_yaml: dict, output_file_name: str): + # Create the directory if it doesn't exist + directory_path = os.path.dirname(output_file_name) + if not os.path.exists(directory_path): + os.makedirs(directory_path) + components = user_yaml.get("spec", "resources")["resources"].get("GenericItems") open(output_file_name, "w").close() with open(output_file_name, "a") as outfile: @@ -1638,6 +1643,11 @@

Functions

Expand source code
def write_components(user_yaml: dict, output_file_name: str):
+    # Create the directory if it doesn't exist
+    directory_path = os.path.dirname(output_file_name)
+    if not os.path.exists(directory_path):
+        os.makedirs(directory_path)
+
     components = user_yaml.get("spec", "resources")["resources"].get("GenericItems")
     open(output_file_name, "w").close()
     with open(output_file_name, "a") as outfile:
diff --git a/docs/detailed-documentation/utils/kube_api_helpers.html b/docs/detailed-documentation/utils/kube_api_helpers.html
index 58fcf7fc..6bf6fe81 100644
--- a/docs/detailed-documentation/utils/kube_api_helpers.html
+++ b/docs/detailed-documentation/utils/kube_api_helpers.html
@@ -74,7 +74,9 @@ 

Module codeflare_sdk.utils.kube_api_helpers

print(nf_msg) return elif e.reason == "Unauthorized" or e.reason == "Forbidden": - raise PermissionError(perm_msg) + if print_error: + print(perm_msg) + return elif e.reason == "Conflict": raise FileExistsError(exists_msg) raise e