Skip to content

Commit 097fb6a

Browse files
Changes in docs for release: v0.13.0
1 parent 65ed743 commit 097fb6a

File tree

8 files changed

+320
-126
lines changed

8 files changed

+320
-126
lines changed

docs/detailed-documentation/cluster/cluster.html

+204-9
Large diffs are not rendered by default.

docs/detailed-documentation/cluster/config.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
100100
<dl>
101101
<dt id="codeflare_sdk.cluster.config.ClusterConfiguration"><code class="flex name class">
102102
<span>class <span class="ident">ClusterConfiguration</span></span>
103-
<span>(</span><span>name: str, namespace: str = None, head_info: list = &lt;factory&gt;, head_cpus: int = 2, head_memory: int = 8, head_gpus: int = 0, machine_types: list = &lt;factory&gt;, min_cpus: int = 1, max_cpus: int = 1, num_workers: int = 1, min_memory: int = 2, max_memory: int = 2, num_gpus: int = 0, template: str = '/home/runner/work/codeflare-sdk/src/codeflare_sdk/templates/base-template.yaml', instascale: bool = False, mcad: bool = True, envs: dict = &lt;factory&gt;, image: str = '', local_interactive: bool = False, image_pull_secrets: list = &lt;factory&gt;, dispatch_priority: str = None, openshift_oauth: bool = False, ingress_options: dict = &lt;factory&gt;, ingress_domain: str = None)</span>
103+
<span>(</span><span>name: str, namespace: str = None, head_info: list = &lt;factory&gt;, head_cpus: int = 2, head_memory: int = 8, head_gpus: int = 0, machine_types: list = &lt;factory&gt;, min_cpus: int = 1, max_cpus: int = 1, num_workers: int = 1, min_memory: int = 2, max_memory: int = 2, num_gpus: int = 0, template: str = '/home/runner/work/codeflare-sdk/codeflare-sdk/src/codeflare_sdk/templates/base-template.yaml', instascale: bool = False, mcad: bool = True, envs: dict = &lt;factory&gt;, image: str = '', local_interactive: bool = False, image_pull_secrets: list = &lt;factory&gt;, dispatch_priority: str = None, openshift_oauth: bool = False, ingress_options: dict = &lt;factory&gt;, ingress_domain: str = None)</span>
104104
</code></dt>
105105
<dd>
106106
<div class="desc"><p>This dataclass is used to specify resource requirements and other details, and
@@ -109,8 +109,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
109109
<summary>
110110
<span>Expand source code</span>
111111
</summary>
112-
<pre><code class="python">@dataclass
113-
class ClusterConfiguration:
112+
<pre><code class="python">class ClusterConfiguration:
114113
&#34;&#34;&#34;
115114
This dataclass is used to specify resource requirements and other details, and
116115
is passed in as an argument when creating a Cluster object.

docs/detailed-documentation/cluster/model.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
145145
<summary>
146146
<span>Expand source code</span>
147147
</summary>
148-
<pre><code class="python">@dataclass
149-
class AppWrapper:
148+
<pre><code class="python">class AppWrapper:
150149
&#34;&#34;&#34;
151150
For storing information about an AppWrapper.
152151
&#34;&#34;&#34;
@@ -299,8 +298,7 @@ <h3>Class variables</h3>
299298
<summary>
300299
<span>Expand source code</span>
301300
</summary>
302-
<pre><code class="python">@dataclass
303-
class RayCluster:
301+
<pre><code class="python">class RayCluster:
304302
&#34;&#34;&#34;
305303
For storing information about a Ray cluster.
306304
&#34;&#34;&#34;

docs/detailed-documentation/job/jobs.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ <h3>Methods</h3>
327327
</dd>
328328
<dt id="codeflare_sdk.job.jobs.DDPJobDefinition"><code class="flex name class">
329329
<span>class <span class="ident">DDPJobDefinition</span></span>
330-
<span>(</span><span>script: Optional[str] = None, m: Optional[str] = None, script_args: Optional[List[str]] = None, name: Optional[str] = None, cpu: Optional[int] = None, gpu: Optional[int] = None, memMB: Optional[int] = None, h: Optional[str] = None, j: Optional[str] = None, env: Optional[Dict[str, str]] = None, max_retries: int = 0, mounts: Optional[List[str]] = None, rdzv_port: int = 29500, rdzv_backend: str = None, scheduler_args: Optional[Dict[str, str]] = None, image: Optional[str] = None, workspace: Optional[str] = 'file:///home/runner/work/codeflare-sdk')</span>
330+
<span>(</span><span>script: Optional[str] = None, m: Optional[str] = None, script_args: Optional[List[str]] = None, name: Optional[str] = None, cpu: Optional[int] = None, gpu: Optional[int] = None, memMB: Optional[int] = None, h: Optional[str] = None, j: Optional[str] = None, env: Optional[Dict[str, str]] = None, max_retries: int = 0, mounts: Optional[List[str]] = None, rdzv_port: int = 29500, rdzv_backend: str = None, scheduler_args: Optional[Dict[str, str]] = None, image: Optional[str] = None, workspace: Optional[str] = 'file:///home/runner/work/codeflare-sdk/codeflare-sdk')</span>
331331
</code></dt>
332332
<dd>
333333
<div class="desc"></div>

docs/detailed-documentation/job/ray_jobs.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
191191
<dl>
192192
<dt id="codeflare_sdk.job.ray_jobs.RayJobClient"><code class="flex name class">
193193
<span>class <span class="ident">RayJobClient</span></span>
194-
<span>(</span><span>address: Optional[str] = None, create_cluster_if_needed: bool = False, cookies: Optional[Dict[str, Any]] = None, metadata: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, Any]] = None, verify: Union[str, bool, ForwardRef(None)] = True)</span>
194+
<span>(</span><span>address: Optional[str] = None, create_cluster_if_needed: bool = False, cookies: Optional[Dict[str, Any]] = None, metadata: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, Any]] = None, verify: Union[str, bool, None] = True)</span>
195195
</code></dt>
196196
<dd>
197197
<div class="desc"><p>A class that functions as a wrapper for the Ray Job Submission Client.</p>
@@ -461,7 +461,7 @@ <h3>Methods</h3>
461461
</details>
462462
</dd>
463463
<dt id="codeflare_sdk.job.ray_jobs.RayJobClient.submit_job"><code class="name flex">
464-
<span>def <span class="ident">submit_job</span></span>(<span>self, entrypoint: str, job_id: Optional[str] = None, runtime_env: Optional[Dict[str, Any]] = None, metadata: Optional[Dict[str, str]] = None, submission_id: Optional[str] = None, entrypoint_num_cpus: Union[int, float, ForwardRef(None)] = None, entrypoint_num_gpus: Union[int, float, ForwardRef(None)] = None, entrypoint_resources: Optional[Dict[str, float]] = None) ‑> str</span>
464+
<span>def <span class="ident">submit_job</span></span>(<span>self, entrypoint: str, job_id: Optional[str] = None, runtime_env: Optional[Dict[str, Any]] = None, metadata: Optional[Dict[str, str]] = None, submission_id: Optional[str] = None, entrypoint_num_cpus: Union[int, float, None] = None, entrypoint_num_gpus: Union[int, float, None] = None, entrypoint_resources: Optional[Dict[str, float]] = None) ‑> str</span>
465465
</code></dt>
466466
<dd>
467467
<div class="desc"><p>Method for submitting jobs to a Ray Cluster and returning the job id with entrypoint being a mandatory field.</p>

docs/detailed-documentation/utils/generate_yaml.html

+52-28
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
6060
from base64 import b64encode
6161
from urllib3.util import parse_url
6262

63-
from .kube_api_helpers import _get_api_host
64-
6563

6664
def read_template(template):
6765
with open(template, &#34;r&#34;) as stream:
@@ -95,9 +93,8 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
9593
return True
9694
else:
9795
return False
98-
except client.ApiException as e: # pragma: no cover
99-
print(f&#34;Error detecting cluster type defaulting to Kubernetes: {e}&#34;)
100-
return False
96+
except Exception as e: # pragma: no cover
97+
return _kube_api_error_handling(e)
10198

10299

103100
def update_dashboard_route(route_item, cluster_name, namespace):
@@ -160,28 +157,45 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
160157
raise ValueError(
161158
f&#34;Error: &#39;port&#39; is not of type int for ingress item at index {index}&#34;
162159
)
163-
if ingress_option[&#34;port&#34;] == 8265:
160+
if ingress_option is not None:
164161
metadata[&#34;name&#34;] = ingress_option[&#34;ingressName&#34;]
165162
metadata[&#34;namespace&#34;] = namespace
166-
if &#34;annotations&#34; not in ingress_option.keys():
163+
metadata[&#34;labels&#34;][&#34;ingress-owner&#34;] = cluster_name
164+
metadata[&#34;labels&#34;][&#34;ingress-options&#34;] = &#34;true&#34;
165+
if (
166+
&#34;annotations&#34; not in ingress_option.keys()
167+
or ingress_option[&#34;annotations&#34;] is None
168+
):
167169
del metadata[&#34;annotations&#34;]
168170
else:
169171
metadata[&#34;annotations&#34;] = ingress_option[&#34;annotations&#34;]
170-
if &#34;path&#34; not in ingress_option.keys():
172+
if (
173+
&#34;path&#34; not in ingress_option.keys()
174+
or ingress_option[&#34;path&#34;] is None
175+
):
171176
del spec[&#34;rules&#34;][0][&#34;http&#34;][&#34;paths&#34;][0][&#34;path&#34;]
172177
else:
173178
spec[&#34;rules&#34;][0][&#34;http&#34;][&#34;paths&#34;][0][&#34;path&#34;] = ingress_option[
174179
&#34;path&#34;
175180
]
176-
if &#34;pathType&#34; not in ingress_option.keys():
181+
if (
182+
&#34;pathType&#34; not in ingress_option.keys()
183+
or ingress_option[&#34;pathType&#34;] is None
184+
):
177185
spec[&#34;rules&#34;][0][&#34;http&#34;][&#34;paths&#34;][0][
178186
&#34;pathType&#34;
179187
] = &#34;ImplementationSpecific&#34;
180-
if &#34;host&#34; not in ingress_option.keys():
188+
if (
189+
&#34;host&#34; not in ingress_option.keys()
190+
or ingress_option[&#34;host&#34;] is None
191+
):
181192
del spec[&#34;rules&#34;][0][&#34;host&#34;]
182193
else:
183194
spec[&#34;rules&#34;][0][&#34;host&#34;] = ingress_option[&#34;host&#34;]
184-
if &#34;ingressClassName&#34; not in ingress_option.keys():
195+
if (
196+
&#34;ingressClassName&#34; not in ingress_option.keys()
197+
or ingress_option[&#34;ingressClassName&#34;] is None
198+
):
185199
del spec[&#34;ingressClassName&#34;]
186200
else:
187201
spec[&#34;ingressClassName&#34;] = ingress_option[&#34;ingressClassName&#34;]
@@ -192,6 +206,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
192206
else:
193207
spec[&#34;ingressClassName&#34;] = &#34;nginx&#34;
194208
metadata[&#34;name&#34;] = gen_dashboard_ingress_name(cluster_name)
209+
metadata[&#34;labels&#34;][&#34;ingress-owner&#34;] = cluster_name
195210
metadata[&#34;namespace&#34;] = namespace
196211
spec[&#34;rules&#34;][0][&#34;http&#34;][&#34;paths&#34;][0][&#34;backend&#34;][&#34;service&#34;][
197212
&#34;name&#34;
@@ -570,10 +585,6 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
570585
tls_secret_name = f&#34;{cluster_name}-proxy-tls-secret&#34;
571586
tls_volume_name = &#34;proxy-tls-secret&#34;
572587
port_name = &#34;oauth-proxy&#34;
573-
host = _get_api_host(k8_client)
574-
host = host.replace(
575-
&#34;api.&#34;, f&#34;{gen_dashboard_ingress_name(cluster_name)}-{namespace}.apps.&#34;
576-
)
577588
oauth_sidecar = _create_oauth_sidecar_object(
578589
namespace,
579590
tls_mount_location,
@@ -909,10 +920,6 @@ <h2 class="section-title" id="header-functions">Functions</h2>
909920
tls_secret_name = f&#34;{cluster_name}-proxy-tls-secret&#34;
910921
tls_volume_name = &#34;proxy-tls-secret&#34;
911922
port_name = &#34;oauth-proxy&#34;
912-
host = _get_api_host(k8_client)
913-
host = host.replace(
914-
&#34;api.&#34;, f&#34;{gen_dashboard_ingress_name(cluster_name)}-{namespace}.apps.&#34;
915-
)
916923
oauth_sidecar = _create_oauth_sidecar_object(
917924
namespace,
918925
tls_mount_location,
@@ -1096,9 +1103,8 @@ <h2 class="section-title" id="header-functions">Functions</h2>
10961103
return True
10971104
else:
10981105
return False
1099-
except client.ApiException as e: # pragma: no cover
1100-
print(f&#34;Error detecting cluster type defaulting to Kubernetes: {e}&#34;)
1101-
return False</code></pre>
1106+
except Exception as e: # pragma: no cover
1107+
return _kube_api_error_handling(e)</code></pre>
11021108
</details>
11031109
</dd>
11041110
<dt id="codeflare_sdk.utils.generate_yaml.read_template"><code class="name flex">
@@ -1268,28 +1274,45 @@ <h2 class="section-title" id="header-functions">Functions</h2>
12681274
raise ValueError(
12691275
f&#34;Error: &#39;port&#39; is not of type int for ingress item at index {index}&#34;
12701276
)
1271-
if ingress_option[&#34;port&#34;] == 8265:
1277+
if ingress_option is not None:
12721278
metadata[&#34;name&#34;] = ingress_option[&#34;ingressName&#34;]
12731279
metadata[&#34;namespace&#34;] = namespace
1274-
if &#34;annotations&#34; not in ingress_option.keys():
1280+
metadata[&#34;labels&#34;][&#34;ingress-owner&#34;] = cluster_name
1281+
metadata[&#34;labels&#34;][&#34;ingress-options&#34;] = &#34;true&#34;
1282+
if (
1283+
&#34;annotations&#34; not in ingress_option.keys()
1284+
or ingress_option[&#34;annotations&#34;] is None
1285+
):
12751286
del metadata[&#34;annotations&#34;]
12761287
else:
12771288
metadata[&#34;annotations&#34;] = ingress_option[&#34;annotations&#34;]
1278-
if &#34;path&#34; not in ingress_option.keys():
1289+
if (
1290+
&#34;path&#34; not in ingress_option.keys()
1291+
or ingress_option[&#34;path&#34;] is None
1292+
):
12791293
del spec[&#34;rules&#34;][0][&#34;http&#34;][&#34;paths&#34;][0][&#34;path&#34;]
12801294
else:
12811295
spec[&#34;rules&#34;][0][&#34;http&#34;][&#34;paths&#34;][0][&#34;path&#34;] = ingress_option[
12821296
&#34;path&#34;
12831297
]
1284-
if &#34;pathType&#34; not in ingress_option.keys():
1298+
if (
1299+
&#34;pathType&#34; not in ingress_option.keys()
1300+
or ingress_option[&#34;pathType&#34;] is None
1301+
):
12851302
spec[&#34;rules&#34;][0][&#34;http&#34;][&#34;paths&#34;][0][
12861303
&#34;pathType&#34;
12871304
] = &#34;ImplementationSpecific&#34;
1288-
if &#34;host&#34; not in ingress_option.keys():
1305+
if (
1306+
&#34;host&#34; not in ingress_option.keys()
1307+
or ingress_option[&#34;host&#34;] is None
1308+
):
12891309
del spec[&#34;rules&#34;][0][&#34;host&#34;]
12901310
else:
12911311
spec[&#34;rules&#34;][0][&#34;host&#34;] = ingress_option[&#34;host&#34;]
1292-
if &#34;ingressClassName&#34; not in ingress_option.keys():
1312+
if (
1313+
&#34;ingressClassName&#34; not in ingress_option.keys()
1314+
or ingress_option[&#34;ingressClassName&#34;] is None
1315+
):
12931316
del spec[&#34;ingressClassName&#34;]
12941317
else:
12951318
spec[&#34;ingressClassName&#34;] = ingress_option[&#34;ingressClassName&#34;]
@@ -1300,6 +1323,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
13001323
else:
13011324
spec[&#34;ingressClassName&#34;] = &#34;nginx&#34;
13021325
metadata[&#34;name&#34;] = gen_dashboard_ingress_name(cluster_name)
1326+
metadata[&#34;labels&#34;][&#34;ingress-owner&#34;] = cluster_name
13031327
metadata[&#34;namespace&#34;] = namespace
13041328
spec[&#34;rules&#34;][0][&#34;http&#34;][&#34;paths&#34;][0][&#34;backend&#34;][&#34;service&#34;][
13051329
&#34;name&#34;

docs/detailed-documentation/utils/kube_api_helpers.html

+1-5
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.kube_api_helpers</code></h1>
7777
raise PermissionError(perm_msg)
7878
elif e.reason == &#34;Conflict&#34;:
7979
raise FileExistsError(exists_msg)
80-
raise e
81-
82-
83-
def _get_api_host(api_client: client.ApiClient): # pragma: no cover
84-
return parse_url(api_client.configuration.host).host</code></pre>
80+
raise e</code></pre>
8581
</details>
8682
</section>
8783
<section>

0 commit comments

Comments
 (0)