Skip to content

Commit 6a74c61

Browse files
Changes in docs for release: v0.14.0
1 parent a3c57ed commit 6a74c61

File tree

8 files changed

+125
-40
lines changed

8 files changed

+125
-40
lines changed

docs/detailed-documentation/cluster/auth.html

+6-9
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,8 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.auth</code></h1>
152152
client.AuthenticationApi(api_client).get_api_group()
153153
config_path = None
154154
return &#34;Logged into %s&#34; % self.server
155-
except client.ApiException: # pragma: no cover
156-
api_client = None
157-
print(&#34;Authentication Error please provide the correct token + server&#34;)
155+
except client.ApiException as e:
156+
_kube_api_error_handling(e)
158157

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

587585
def logout(self) -&gt; str:
588586
&#34;&#34;&#34;
@@ -637,9 +635,8 @@ <h3>Methods</h3>
637635
client.AuthenticationApi(api_client).get_api_group()
638636
config_path = None
639637
return &#34;Logged into %s&#34; % self.server
640-
except client.ApiException: # pragma: no cover
641-
api_client = None
642-
print(&#34;Authentication Error please provide the correct token + server&#34;)</code></pre>
638+
except client.ApiException as e:
639+
_kube_api_error_handling(e)</code></pre>
643640
</details>
644641
</dd>
645642
<dt id="codeflare_sdk.cluster.auth.TokenAuthentication.logout"><code class="name flex">

docs/detailed-documentation/cluster/cluster.html

+50-28
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
589589
if resource[&#34;kind&#34;] == &#34;RayCluster&#34;:
590590
api_instance.create_namespaced_custom_object(
591591
group=&#34;ray.io&#34;,
592-
version=&#34;v1alpha1&#34;,
592+
version=&#34;v1&#34;,
593593
namespace=namespace,
594594
plural=&#34;rayclusters&#34;,
595595
body=resource,
@@ -626,7 +626,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
626626
if resource[&#34;kind&#34;] == &#34;RayCluster&#34;:
627627
api_instance.delete_namespaced_custom_object(
628628
group=&#34;ray.io&#34;,
629-
version=&#34;v1alpha1&#34;,
629+
version=&#34;v1&#34;,
630630
namespace=namespace,
631631
plural=&#34;rayclusters&#34;,
632632
name=self.app_wrapper_name,
@@ -713,7 +713,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
713713
api_instance = client.CustomObjectsApi(api_config_handler())
714714
rcs = api_instance.list_namespaced_custom_object(
715715
group=&#34;ray.io&#34;,
716-
version=&#34;v1alpha1&#34;,
716+
version=&#34;v1&#34;,
717717
namespace=namespace,
718718
plural=&#34;rayclusters&#34;,
719719
)
@@ -870,7 +870,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
870870
api_instance = client.CustomObjectsApi(api_config_handler())
871871
rcs = api_instance.list_namespaced_custom_object(
872872
group=&#34;ray.io&#34;,
873-
version=&#34;v1alpha1&#34;,
873+
version=&#34;v1&#34;,
874874
namespace=namespace,
875875
plural=&#34;rayclusters&#34;,
876876
)
@@ -890,7 +890,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
890890
api_instance = client.CustomObjectsApi(api_config_handler())
891891
rcs = api_instance.list_namespaced_custom_object(
892892
group=&#34;ray.io&#34;,
893-
version=&#34;v1alpha1&#34;,
893+
version=&#34;v1&#34;,
894894
namespace=namespace,
895895
plural=&#34;rayclusters&#34;,
896896
)
@@ -934,25 +934,47 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
934934
status = RayClusterStatus(rc[&#34;status&#34;][&#34;state&#34;].lower())
935935
else:
936936
status = RayClusterStatus.UNKNOWN
937-
try:
938-
config_check()
939-
api_instance = client.NetworkingV1Api(api_config_handler())
940-
ingresses = api_instance.list_namespaced_ingress(rc[&#34;metadata&#34;][&#34;namespace&#34;])
941-
except Exception as e: # pragma no cover
942-
return _kube_api_error_handling(e)
943-
ray_ingress = None
944-
for ingress in ingresses.items:
945-
annotations = ingress.metadata.annotations
946-
protocol = &#34;http&#34;
947-
if (
948-
ingress.metadata.name == f&#34;ray-dashboard-{rc[&#39;metadata&#39;][&#39;name&#39;]}&#34;
949-
or ingress.metadata.name.startswith(f&#34;{rc[&#39;metadata&#39;][&#39;name&#39;]}-ingress&#34;)
950-
):
951-
if annotations == None:
952-
protocol = &#34;http&#34;
953-
elif &#34;route.openshift.io/termination&#34; in annotations:
954-
protocol = &#34;https&#34;
955-
ray_ingress = f&#34;{protocol}://{ingress.spec.rules[0].host}&#34;
937+
config_check()
938+
dashboard_url = None
939+
if is_openshift_cluster():
940+
try:
941+
api_instance = client.CustomObjectsApi(api_config_handler())
942+
routes = api_instance.list_namespaced_custom_object(
943+
group=&#34;route.openshift.io&#34;,
944+
version=&#34;v1&#34;,
945+
namespace=rc[&#34;metadata&#34;][&#34;namespace&#34;],
946+
plural=&#34;routes&#34;,
947+
)
948+
except Exception as e: # pragma: no cover
949+
return _kube_api_error_handling(e)
950+
951+
for route in routes[&#34;items&#34;]:
952+
rc_name = rc[&#34;metadata&#34;][&#34;name&#34;]
953+
if route[&#34;metadata&#34;][&#34;name&#34;] == f&#34;ray-dashboard-{rc_name}&#34; or route[
954+
&#34;metadata&#34;
955+
][&#34;name&#34;].startswith(f&#34;{rc_name}-ingress&#34;):
956+
protocol = &#34;https&#34; if route[&#34;spec&#34;].get(&#34;tls&#34;) else &#34;http&#34;
957+
dashboard_url = f&#34;{protocol}://{route[&#39;spec&#39;][&#39;host&#39;]}&#34;
958+
else:
959+
try:
960+
api_instance = client.NetworkingV1Api(api_config_handler())
961+
ingresses = api_instance.list_namespaced_ingress(
962+
rc[&#34;metadata&#34;][&#34;namespace&#34;]
963+
)
964+
except Exception as e: # pragma no cover
965+
return _kube_api_error_handling(e)
966+
for ingress in ingresses.items:
967+
annotations = ingress.metadata.annotations
968+
protocol = &#34;http&#34;
969+
if (
970+
ingress.metadata.name == f&#34;ray-dashboard-{rc[&#39;metadata&#39;][&#39;name&#39;]}&#34;
971+
or ingress.metadata.name.startswith(f&#34;{rc[&#39;metadata&#39;][&#39;name&#39;]}-ingress&#34;)
972+
):
973+
if annotations == None:
974+
protocol = &#34;http&#34;
975+
elif &#34;route.openshift.io/termination&#34; in annotations:
976+
protocol = &#34;https&#34;
977+
dashboard_url = f&#34;{protocol}://{ingress.spec.rules[0].host}&#34;
956978

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

9851007

@@ -1068,7 +1090,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
10681090
api_instance = client.CustomObjectsApi(api_config_handler())
10691091
rcs = api_instance.list_namespaced_custom_object(
10701092
group=&#34;ray.io&#34;,
1071-
version=&#34;v1alpha1&#34;,
1093+
version=&#34;v1&#34;,
10721094
namespace=namespace,
10731095
plural=&#34;rayclusters&#34;,
10741096
)
@@ -1777,7 +1799,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
17771799
if resource[&#34;kind&#34;] == &#34;RayCluster&#34;:
17781800
api_instance.create_namespaced_custom_object(
17791801
group=&#34;ray.io&#34;,
1780-
version=&#34;v1alpha1&#34;,
1802+
version=&#34;v1&#34;,
17811803
namespace=namespace,
17821804
plural=&#34;rayclusters&#34;,
17831805
body=resource,
@@ -1814,7 +1836,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
18141836
if resource[&#34;kind&#34;] == &#34;RayCluster&#34;:
18151837
api_instance.delete_namespaced_custom_object(
18161838
group=&#34;ray.io&#34;,
1817-
version=&#34;v1alpha1&#34;,
1839+
version=&#34;v1&#34;,
18181840
namespace=namespace,
18191841
plural=&#34;rayclusters&#34;,
18201842
name=self.app_wrapper_name,

docs/detailed-documentation/cluster/index.html

+23
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,29 @@
2222
<h1 class="title">Module <code>codeflare_sdk.cluster</code></h1>
2323
</header>
2424
<section id="section-intro">
25+
<details class="source">
26+
<summary>
27+
<span>Expand source code</span>
28+
</summary>
29+
<pre><code class="python">from .auth import (
30+
Authentication,
31+
KubeConfiguration,
32+
TokenAuthentication,
33+
KubeConfigFileAuthentication,
34+
)
35+
36+
from .model import (
37+
RayClusterStatus,
38+
AppWrapperStatus,
39+
CodeFlareClusterStatus,
40+
RayCluster,
41+
AppWrapper,
42+
)
43+
44+
from .cluster import Cluster, ClusterConfiguration
45+
46+
from .awload import AWManager</code></pre>
47+
</details>
2548
</section>
2649
<section>
2750
<h2 class="section-title" id="header-submodules">Sub-modules</h2>

docs/detailed-documentation/cluster/model.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.model</code></h1>
6060
Defines the possible reportable states of a Ray cluster.
6161
&#34;&#34;&#34;
6262

63-
# https://github.com/ray-project/kuberay/blob/master/ray-operator/apis/ray/v1alpha1/raycluster_types.go#L95
63+
# https://github.com/ray-project/kuberay/blob/master/ray-operator/apis/ray/v1/raycluster_types.go#L112-L117
6464
READY = &#34;ready&#34;
6565
UNHEALTHY = &#34;unhealthy&#34;
6666
FAILED = &#34;failed&#34;
@@ -383,7 +383,7 @@ <h3>Class variables</h3>
383383
Defines the possible reportable states of a Ray cluster.
384384
&#34;&#34;&#34;
385385

386-
# https://github.com/ray-project/kuberay/blob/master/ray-operator/apis/ray/v1alpha1/raycluster_types.go#L95
386+
# https://github.com/ray-project/kuberay/blob/master/ray-operator/apis/ray/v1/raycluster_types.go#L112-L117
387387
READY = &#34;ready&#34;
388388
UNHEALTHY = &#34;unhealthy&#34;
389389
FAILED = &#34;failed&#34;

docs/detailed-documentation/index.html

+23
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,29 @@
2222
<h1 class="title">Package <code>codeflare_sdk</code></h1>
2323
</header>
2424
<section id="section-intro">
25+
<details class="source">
26+
<summary>
27+
<span>Expand source code</span>
28+
</summary>
29+
<pre><code class="python">from .cluster import (
30+
Authentication,
31+
KubeConfiguration,
32+
TokenAuthentication,
33+
KubeConfigFileAuthentication,
34+
AWManager,
35+
Cluster,
36+
ClusterConfiguration,
37+
RayClusterStatus,
38+
AppWrapperStatus,
39+
CodeFlareClusterStatus,
40+
RayCluster,
41+
AppWrapper,
42+
)
43+
44+
from .job import JobDefinition, Job, DDPJobDefinition, DDPJob, RayJobClient
45+
46+
from .utils import generate_cert</code></pre>
47+
</details>
2548
</section>
2649
<section>
2750
<h2 class="section-title" id="header-submodules">Sub-modules</h2>

docs/detailed-documentation/job/index.html

+8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222
<h1 class="title">Module <code>codeflare_sdk.job</code></h1>
2323
</header>
2424
<section id="section-intro">
25+
<details class="source">
26+
<summary>
27+
<span>Expand source code</span>
28+
</summary>
29+
<pre><code class="python">from .jobs import JobDefinition, Job, DDPJobDefinition, DDPJob
30+
31+
from .ray_jobs import RayJobClient</code></pre>
32+
</details>
2533
</section>
2634
<section>
2735
<h2 class="section-title" id="header-submodules">Sub-modules</h2>

docs/detailed-documentation/utils/generate_yaml.html

+10
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,11 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
650650

651651

652652
def write_components(user_yaml: dict, output_file_name: str):
653+
# Create the directory if it doesn&#39;t exist
654+
directory_path = os.path.dirname(output_file_name)
655+
if not os.path.exists(directory_path):
656+
os.makedirs(directory_path)
657+
653658
components = user_yaml.get(&#34;spec&#34;, &#34;resources&#34;)[&#34;resources&#34;].get(&#34;GenericItems&#34;)
654659
open(output_file_name, &#34;w&#34;).close()
655660
with open(output_file_name, &#34;a&#34;) as outfile:
@@ -1638,6 +1643,11 @@ <h2 class="section-title" id="header-functions">Functions</h2>
16381643
<span>Expand source code</span>
16391644
</summary>
16401645
<pre><code class="python">def write_components(user_yaml: dict, output_file_name: str):
1646+
# Create the directory if it doesn&#39;t exist
1647+
directory_path = os.path.dirname(output_file_name)
1648+
if not os.path.exists(directory_path):
1649+
os.makedirs(directory_path)
1650+
16411651
components = user_yaml.get(&#34;spec&#34;, &#34;resources&#34;)[&#34;resources&#34;].get(&#34;GenericItems&#34;)
16421652
open(output_file_name, &#34;w&#34;).close()
16431653
with open(output_file_name, &#34;a&#34;) as outfile:

docs/detailed-documentation/utils/kube_api_helpers.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ <h1 class="title">Module <code>codeflare_sdk.utils.kube_api_helpers</code></h1>
7474
print(nf_msg)
7575
return
7676
elif e.reason == &#34;Unauthorized&#34; or e.reason == &#34;Forbidden&#34;:
77-
raise PermissionError(perm_msg)
77+
if print_error:
78+
print(perm_msg)
79+
return
7880
elif e.reason == &#34;Conflict&#34;:
7981
raise FileExistsError(exists_msg)
8082
raise e</code></pre>

0 commit comments

Comments
 (0)