Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions docs/detailed-documentation/cluster/auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.auth</code></h1>
client.AuthenticationApi(api_client).get_api_group()
config_path = None
return &#34;Logged into %s&#34; % self.server
except client.ApiException: # pragma: no cover
api_client = None
print(&#34;Authentication Error please provide the correct token + server&#34;)
except client.ApiException as e:
_kube_api_error_handling(e)

def logout(self) -&gt; str:
&#34;&#34;&#34;
Expand Down Expand Up @@ -580,9 +579,8 @@ <h3>Methods</h3>
client.AuthenticationApi(api_client).get_api_group()
config_path = None
return &#34;Logged into %s&#34; % self.server
except client.ApiException: # pragma: no cover
api_client = None
print(&#34;Authentication Error please provide the correct token + server&#34;)
except client.ApiException as e:
_kube_api_error_handling(e)

def logout(self) -&gt; str:
&#34;&#34;&#34;
Expand Down Expand Up @@ -637,9 +635,8 @@ <h3>Methods</h3>
client.AuthenticationApi(api_client).get_api_group()
config_path = None
return &#34;Logged into %s&#34; % self.server
except client.ApiException: # pragma: no cover
api_client = None
print(&#34;Authentication Error please provide the correct token + server&#34;)</code></pre>
except client.ApiException as e:
_kube_api_error_handling(e)</code></pre>
</details>
</dd>
<dt id="codeflare_sdk.cluster.auth.TokenAuthentication.logout"><code class="name flex">
Expand Down
78 changes: 50 additions & 28 deletions docs/detailed-documentation/cluster/cluster.html
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
if resource[&#34;kind&#34;] == &#34;RayCluster&#34;:
api_instance.create_namespaced_custom_object(
group=&#34;ray.io&#34;,
version=&#34;v1alpha1&#34;,
version=&#34;v1&#34;,
namespace=namespace,
plural=&#34;rayclusters&#34;,
body=resource,
Expand Down Expand Up @@ -626,7 +626,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
if resource[&#34;kind&#34;] == &#34;RayCluster&#34;:
api_instance.delete_namespaced_custom_object(
group=&#34;ray.io&#34;,
version=&#34;v1alpha1&#34;,
version=&#34;v1&#34;,
namespace=namespace,
plural=&#34;rayclusters&#34;,
name=self.app_wrapper_name,
Expand Down Expand Up @@ -713,7 +713,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
api_instance = client.CustomObjectsApi(api_config_handler())
rcs = api_instance.list_namespaced_custom_object(
group=&#34;ray.io&#34;,
version=&#34;v1alpha1&#34;,
version=&#34;v1&#34;,
namespace=namespace,
plural=&#34;rayclusters&#34;,
)
Expand Down Expand Up @@ -870,7 +870,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
api_instance = client.CustomObjectsApi(api_config_handler())
rcs = api_instance.list_namespaced_custom_object(
group=&#34;ray.io&#34;,
version=&#34;v1alpha1&#34;,
version=&#34;v1&#34;,
namespace=namespace,
plural=&#34;rayclusters&#34;,
)
Expand All @@ -890,7 +890,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
api_instance = client.CustomObjectsApi(api_config_handler())
rcs = api_instance.list_namespaced_custom_object(
group=&#34;ray.io&#34;,
version=&#34;v1alpha1&#34;,
version=&#34;v1&#34;,
namespace=namespace,
plural=&#34;rayclusters&#34;,
)
Expand Down Expand Up @@ -934,25 +934,47 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
status = RayClusterStatus(rc[&#34;status&#34;][&#34;state&#34;].lower())
else:
status = RayClusterStatus.UNKNOWN
try:
config_check()
api_instance = client.NetworkingV1Api(api_config_handler())
ingresses = api_instance.list_namespaced_ingress(rc[&#34;metadata&#34;][&#34;namespace&#34;])
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 = &#34;http&#34;
if (
ingress.metadata.name == f&#34;ray-dashboard-{rc[&#39;metadata&#39;][&#39;name&#39;]}&#34;
or ingress.metadata.name.startswith(f&#34;{rc[&#39;metadata&#39;][&#39;name&#39;]}-ingress&#34;)
):
if annotations == None:
protocol = &#34;http&#34;
elif &#34;route.openshift.io/termination&#34; in annotations:
protocol = &#34;https&#34;
ray_ingress = f&#34;{protocol}://{ingress.spec.rules[0].host}&#34;
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=&#34;route.openshift.io&#34;,
version=&#34;v1&#34;,
namespace=rc[&#34;metadata&#34;][&#34;namespace&#34;],
plural=&#34;routes&#34;,
)
except Exception as e: # pragma: no cover
return _kube_api_error_handling(e)

for route in routes[&#34;items&#34;]:
rc_name = rc[&#34;metadata&#34;][&#34;name&#34;]
if route[&#34;metadata&#34;][&#34;name&#34;] == f&#34;ray-dashboard-{rc_name}&#34; or route[
&#34;metadata&#34;
][&#34;name&#34;].startswith(f&#34;{rc_name}-ingress&#34;):
protocol = &#34;https&#34; if route[&#34;spec&#34;].get(&#34;tls&#34;) else &#34;http&#34;
dashboard_url = f&#34;{protocol}://{route[&#39;spec&#39;][&#39;host&#39;]}&#34;
else:
try:
api_instance = client.NetworkingV1Api(api_config_handler())
ingresses = api_instance.list_namespaced_ingress(
rc[&#34;metadata&#34;][&#34;namespace&#34;]
)
except Exception as e: # pragma no cover
return _kube_api_error_handling(e)
for ingress in ingresses.items:
annotations = ingress.metadata.annotations
protocol = &#34;http&#34;
if (
ingress.metadata.name == f&#34;ray-dashboard-{rc[&#39;metadata&#39;][&#39;name&#39;]}&#34;
or ingress.metadata.name.startswith(f&#34;{rc[&#39;metadata&#39;][&#39;name&#39;]}-ingress&#34;)
):
if annotations == None:
protocol = &#34;http&#34;
elif &#34;route.openshift.io/termination&#34; in annotations:
protocol = &#34;https&#34;
dashboard_url = f&#34;{protocol}://{ingress.spec.rules[0].host}&#34;

return RayCluster(
name=rc[&#34;metadata&#34;][&#34;name&#34;],
Expand All @@ -979,7 +1001,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
head_gpu=rc[&#34;spec&#34;][&#34;headGroupSpec&#34;][&#34;template&#34;][&#34;spec&#34;][&#34;containers&#34;][0][
&#34;resources&#34;
][&#34;limits&#34;][&#34;nvidia.com/gpu&#34;],
dashboard=ray_ingress,
dashboard=dashboard_url,
)


Expand Down Expand Up @@ -1068,7 +1090,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
api_instance = client.CustomObjectsApi(api_config_handler())
rcs = api_instance.list_namespaced_custom_object(
group=&#34;ray.io&#34;,
version=&#34;v1alpha1&#34;,
version=&#34;v1&#34;,
namespace=namespace,
plural=&#34;rayclusters&#34;,
)
Expand Down Expand Up @@ -1777,7 +1799,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
if resource[&#34;kind&#34;] == &#34;RayCluster&#34;:
api_instance.create_namespaced_custom_object(
group=&#34;ray.io&#34;,
version=&#34;v1alpha1&#34;,
version=&#34;v1&#34;,
namespace=namespace,
plural=&#34;rayclusters&#34;,
body=resource,
Expand Down Expand Up @@ -1814,7 +1836,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
if resource[&#34;kind&#34;] == &#34;RayCluster&#34;:
api_instance.delete_namespaced_custom_object(
group=&#34;ray.io&#34;,
version=&#34;v1alpha1&#34;,
version=&#34;v1&#34;,
namespace=namespace,
plural=&#34;rayclusters&#34;,
name=self.app_wrapper_name,
Expand Down
23 changes: 23 additions & 0 deletions docs/detailed-documentation/cluster/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,29 @@
<h1 class="title">Module <code>codeflare_sdk.cluster</code></h1>
</header>
<section id="section-intro">
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">from .auth import (
Authentication,
KubeConfiguration,
TokenAuthentication,
KubeConfigFileAuthentication,
)

from .model import (
RayClusterStatus,
AppWrapperStatus,
CodeFlareClusterStatus,
RayCluster,
AppWrapper,
)

from .cluster import Cluster, ClusterConfiguration

from .awload import AWManager</code></pre>
</details>
</section>
<section>
<h2 class="section-title" id="header-submodules">Sub-modules</h2>
Expand Down
4 changes: 2 additions & 2 deletions docs/detailed-documentation/cluster/model.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.model</code></h1>
Defines the possible reportable states of a Ray cluster.
&#34;&#34;&#34;

# 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 = &#34;ready&#34;
UNHEALTHY = &#34;unhealthy&#34;
FAILED = &#34;failed&#34;
Expand Down Expand Up @@ -383,7 +383,7 @@ <h3>Class variables</h3>
Defines the possible reportable states of a Ray cluster.
&#34;&#34;&#34;

# 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 = &#34;ready&#34;
UNHEALTHY = &#34;unhealthy&#34;
FAILED = &#34;failed&#34;
Expand Down
23 changes: 23 additions & 0 deletions docs/detailed-documentation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,29 @@
<h1 class="title">Package <code>codeflare_sdk</code></h1>
</header>
<section id="section-intro">
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">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</code></pre>
</details>
</section>
<section>
<h2 class="section-title" id="header-submodules">Sub-modules</h2>
Expand Down
8 changes: 8 additions & 0 deletions docs/detailed-documentation/job/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
<h1 class="title">Module <code>codeflare_sdk.job</code></h1>
</header>
<section id="section-intro">
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">from .jobs import JobDefinition, Job, DDPJobDefinition, DDPJob

from .ray_jobs import RayJobClient</code></pre>
</details>
</section>
<section>
<h2 class="section-title" id="header-submodules">Sub-modules</h2>
Expand Down
10 changes: 10 additions & 0 deletions docs/detailed-documentation/utils/generate_yaml.html
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,11 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>


def write_components(user_yaml: dict, output_file_name: str):
# Create the directory if it doesn&#39;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(&#34;spec&#34;, &#34;resources&#34;)[&#34;resources&#34;].get(&#34;GenericItems&#34;)
open(output_file_name, &#34;w&#34;).close()
with open(output_file_name, &#34;a&#34;) as outfile:
Expand Down Expand Up @@ -1638,6 +1643,11 @@ <h2 class="section-title" id="header-functions">Functions</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">def write_components(user_yaml: dict, output_file_name: str):
# Create the directory if it doesn&#39;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(&#34;spec&#34;, &#34;resources&#34;)[&#34;resources&#34;].get(&#34;GenericItems&#34;)
open(output_file_name, &#34;w&#34;).close()
with open(output_file_name, &#34;a&#34;) as outfile:
Expand Down
4 changes: 3 additions & 1 deletion docs/detailed-documentation/utils/kube_api_helpers.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ <h1 class="title">Module <code>codeflare_sdk.utils.kube_api_helpers</code></h1>
print(nf_msg)
return
elif e.reason == &#34;Unauthorized&#34; or e.reason == &#34;Forbidden&#34;:
raise PermissionError(perm_msg)
if print_error:
print(perm_msg)
return
elif e.reason == &#34;Conflict&#34;:
raise FileExistsError(exists_msg)
raise e</code></pre>
Expand Down