Skip to content

Commit 5019a34

Browse files
committed
docs: update docs
1 parent 92ad939 commit 5019a34

File tree

5 files changed

+74
-10
lines changed

5 files changed

+74
-10
lines changed

docs/cluster/cluster.html

+7-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
116116
instascale = self.config.instascale
117117
instance_types = self.config.machine_types
118118
env = self.config.envs
119+
pull_secret = self.config.pull_secret
119120
return generate_appwrapper(
120121
name=name,
121122
namespace=namespace,
@@ -130,6 +131,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
130131
instascale=instascale,
131132
instance_types=instance_types,
132133
env=env,
134+
pull_secret=pull_secret,
133135
)
134136

135137
# creates a new cluster with the provided or default spec
@@ -635,6 +637,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
635637
instascale = self.config.instascale
636638
instance_types = self.config.machine_types
637639
env = self.config.envs
640+
pull_secret = self.config.pull_secret
638641
return generate_appwrapper(
639642
name=name,
640643
namespace=namespace,
@@ -649,6 +652,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
649652
instascale=instascale,
650653
instance_types=instance_types,
651654
env=env,
655+
pull_secret=pull_secret,
652656
)
653657

654658
# creates a new cluster with the provided or default spec
@@ -930,6 +934,7 @@ <h3>Methods</h3>
930934
instascale = self.config.instascale
931935
instance_types = self.config.machine_types
932936
env = self.config.envs
937+
pull_secret = self.config.pull_secret
933938
return generate_appwrapper(
934939
name=name,
935940
namespace=namespace,
@@ -944,6 +949,7 @@ <h3>Methods</h3>
944949
instascale=instascale,
945950
instance_types=instance_types,
946951
env=env,
952+
pull_secret=pull_secret,
947953
)</code></pre>
948954
</details>
949955
</dd>
@@ -1036,7 +1042,7 @@ <h3>Methods</h3>
10361042
</details>
10371043
</dd>
10381044
<dt id="codeflare_sdk.cluster.cluster.Cluster.list_jobs"><code class="name flex">
1039-
<span>def <span class="ident">list_jobs</span></span>(<span>self) ‑> List[~T]</span>
1045+
<span>def <span class="ident">list_jobs</span></span>(<span>self) ‑> List</span>
10401046
</code></dt>
10411047
<dd>
10421048
<div class="desc"><p>This method accesses the head ray node in your cluster and lists the running jobs.</p></div>

docs/cluster/config.html

+12-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.config</code></h1>
7979
template: str = f&#34;{dir}/templates/new-template.yaml&#34;
8080
instascale: bool = False
8181
envs: dict = field(default_factory=dict)
82-
image: str = &#34;ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103&#34;</code></pre>
82+
image: str = &#34;ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103&#34;
83+
pull_secret: dict = field(default_factory=dict)</code></pre>
8384
</details>
8485
</section>
8586
<section>
@@ -93,7 +94,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
9394
<dl>
9495
<dt id="codeflare_sdk.cluster.config.ClusterConfiguration"><code class="flex name class">
9596
<span>class <span class="ident">ClusterConfiguration</span></span>
96-
<span>(</span><span>name: str, namespace: str = None, head_info: list = &lt;factory&gt;, machine_types: list = &lt;factory&gt;, min_cpus: int = 1, max_cpus: int = 1, min_worker: int = 1, max_worker: int = 1, min_memory: int = 2, max_memory: int = 2, gpu: int = 0, template: str = '/Users/aasthana/go/src/github.com/codeflare-sdk/src/codeflare_sdk/templates/new-template.yaml', instascale: bool = False, envs: dict = &lt;factory&gt;, image: str = 'ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103')</span>
97+
<span>(</span><span>name: str, namespace: str = None, head_info: list = &lt;factory&gt;, machine_types: list = &lt;factory&gt;, min_cpus: int = 1, max_cpus: int = 1, min_worker: int = 1, max_worker: int = 1, min_memory: int = 2, max_memory: int = 2, gpu: int = 0, template: str = '/home/eoingallinagh/Documents/RedHat/codeflare-sdk/src/codeflare_sdk/templates/new-template.yaml', instascale: bool = False, envs: dict = &lt;factory&gt;, image: str = 'ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103', pull_secret: dict = &lt;factory&gt;)</span>
9798
</code></dt>
9899
<dd>
99100
<div class="desc"><p>This dataclass is used to specify resource requirements and other details, and
@@ -102,7 +103,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
102103
<summary>
103104
<span>Expand source code</span>
104105
</summary>
105-
<pre><code class="python">class ClusterConfiguration:
106+
<pre><code class="python">@dataclass
107+
class ClusterConfiguration:
106108
&#34;&#34;&#34;
107109
This dataclass is used to specify resource requirements and other details, and
108110
is passed in as an argument when creating a Cluster object.
@@ -122,7 +124,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
122124
template: str = f&#34;{dir}/templates/new-template.yaml&#34;
123125
instascale: bool = False
124126
envs: dict = field(default_factory=dict)
125-
image: str = &#34;ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103&#34;</code></pre>
127+
image: str = &#34;ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103&#34;
128+
pull_secret: dict = field(default_factory=dict)</code></pre>
126129
</details>
127130
<h3>Class variables</h3>
128131
<dl>
@@ -182,6 +185,10 @@ <h3>Class variables</h3>
182185
<dd>
183186
<div class="desc"></div>
184187
</dd>
188+
<dt id="codeflare_sdk.cluster.config.ClusterConfiguration.pull_secret"><code class="name">var <span class="ident">pull_secret</span> : dict</code></dt>
189+
<dd>
190+
<div class="desc"></div>
191+
</dd>
185192
<dt id="codeflare_sdk.cluster.config.ClusterConfiguration.template"><code class="name">var <span class="ident">template</span> : str</code></dt>
186193
<dd>
187194
<div class="desc"></div>
@@ -221,6 +228,7 @@ <h4><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration" href="#co
221228
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.min_worker" href="#codeflare_sdk.cluster.config.ClusterConfiguration.min_worker">min_worker</a></code></li>
222229
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.name" href="#codeflare_sdk.cluster.config.ClusterConfiguration.name">name</a></code></li>
223230
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.namespace" href="#codeflare_sdk.cluster.config.ClusterConfiguration.namespace">namespace</a></code></li>
231+
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.pull_secret" href="#codeflare_sdk.cluster.config.ClusterConfiguration.pull_secret">pull_secret</a></code></li>
224232
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.template" href="#codeflare_sdk.cluster.config.ClusterConfiguration.template">template</a></code></li>
225233
</ul>
226234
</li>

docs/cluster/model.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
141141
<summary>
142142
<span>Expand source code</span>
143143
</summary>
144-
<pre><code class="python">class AppWrapper:
144+
<pre><code class="python">@dataclass
145+
class AppWrapper:
145146
&#34;&#34;&#34;
146147
For storing information about an AppWrapper.
147148
&#34;&#34;&#34;
@@ -284,7 +285,8 @@ <h3>Class variables</h3>
284285
<summary>
285286
<span>Expand source code</span>
286287
</summary>
287-
<pre><code class="python">class RayCluster:
288+
<pre><code class="python">@dataclass
289+
class RayCluster:
288290
&#34;&#34;&#34;
289291
For storing information about a Ray cluster.
290292
&#34;&#34;&#34;

docs/job/jobs.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ <h3>Methods</h3>
305305
</dd>
306306
<dt id="codeflare_sdk.job.jobs.DDPJobDefinition"><code class="flex name class">
307307
<span>class <span class="ident">DDPJobDefinition</span></span>
308-
<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:///Users/aasthana/go/src/github.com/codeflare-sdk')</span>
308+
<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/eoingallinagh/Documents/RedHat/codeflare-sdk')</span>
309309
</code></dt>
310310
<dd>
311311
<div class="desc"></div>

docs/utils/generate_yaml.html

+50-2
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
161161
container[&#34;image&#34;] = image
162162

163163

164+
def update_pull_secret(spec, pull_secret):
165+
if pull_secret:
166+
if &#34;imagePullSecrets&#34; not in spec:
167+
spec[&#34;imagePullSecrets&#34;] = []
168+
spec[&#34;imagePullSecrets&#34;].append(pull_secret)
169+
170+
164171
def update_env(spec, env):
165172
containers = spec.get(&#34;containers&#34;)
166173
for container in containers:
@@ -198,6 +205,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
198205
image,
199206
instascale,
200207
env,
208+
pull_secret,
201209
):
202210
if &#34;generictemplate&#34; in item.keys():
203211
head = item.get(&#34;generictemplate&#34;).get(&#34;spec&#34;).get(&#34;headGroupSpec&#34;)
@@ -213,6 +221,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
213221
for comp in [head, worker]:
214222
spec = comp.get(&#34;template&#34;).get(&#34;spec&#34;)
215223
update_affinity(spec, appwrapper_name, instascale)
224+
update_pull_secret(spec, pull_secret)
216225
update_image(spec, image)
217226
update_env(spec, env)
218227
if comp == head:
@@ -241,6 +250,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
241250
instascale: bool,
242251
instance_types: list,
243252
env,
253+
pull_secret: str,
244254
):
245255
user_yaml = read_template(template)
246256
appwrapper_name, cluster_name = gen_names(name)
@@ -264,6 +274,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
264274
image,
265275
instascale,
266276
env,
277+
pull_secret,
267278
)
268279
update_dashboard_route(route_item, cluster_name, namespace)
269280
outfile = appwrapper_name + &#34;.yaml&#34;
@@ -345,6 +356,12 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
345356
default=&#34;default&#34;,
346357
help=&#34;Set the kubernetes namespace you want to deploy your cluster to. Default. If left blank, uses the &#39;default&#39; namespace&#34;,
347358
)
359+
parser.add_argument(
360+
&#34;--pull-secret&#34;,
361+
required=False,
362+
default=&#34;&#34;,
363+
help=&#34;Set pull secret for a private registry&#34;,
364+
)
348365

349366
args = parser.parse_args()
350367
name = args.name
@@ -360,6 +377,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
360377
instance_types = args.instance_types
361378
namespace = args.namespace
362379
env = {}
380+
pull_secret = args.pull_secret
363381

364382
outfile = generate_appwrapper(
365383
name,
@@ -375,6 +393,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
375393
instascale,
376394
instance_types,
377395
env,
396+
pull_secret,
378397
)
379398
return outfile
380399

@@ -410,7 +429,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
410429
</details>
411430
</dd>
412431
<dt id="codeflare_sdk.utils.generate_yaml.generate_appwrapper"><code class="name flex">
413-
<span>def <span class="ident">generate_appwrapper</span></span>(<span>name: str, namespace: str, min_cpu: int, max_cpu: int, min_memory: int, max_memory: int, gpu: int, workers: int, template: str, image: str, instascale: bool, instance_types: list, env)</span>
432+
<span>def <span class="ident">generate_appwrapper</span></span>(<span>name: str, namespace: str, min_cpu: int, max_cpu: int, min_memory: int, max_memory: int, gpu: int, workers: int, template: str, image: str, instascale: bool, instance_types: list, env, pull_secret: str)</span>
414433
</code></dt>
415434
<dd>
416435
<div class="desc"></div>
@@ -432,6 +451,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
432451
instascale: bool,
433452
instance_types: list,
434453
env,
454+
pull_secret: str,
435455
):
436456
user_yaml = read_template(template)
437457
appwrapper_name, cluster_name = gen_names(name)
@@ -455,6 +475,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
455475
image,
456476
instascale,
457477
env,
478+
pull_secret,
458479
)
459480
update_dashboard_route(route_item, cluster_name, namespace)
460481
outfile = appwrapper_name + &#34;.yaml&#34;
@@ -545,6 +566,12 @@ <h2 class="section-title" id="header-functions">Functions</h2>
545566
default=&#34;default&#34;,
546567
help=&#34;Set the kubernetes namespace you want to deploy your cluster to. Default. If left blank, uses the &#39;default&#39; namespace&#34;,
547568
)
569+
parser.add_argument(
570+
&#34;--pull-secret&#34;,
571+
required=False,
572+
default=&#34;&#34;,
573+
help=&#34;Set pull secret for a private registry&#34;,
574+
)
548575

549576
args = parser.parse_args()
550577
name = args.name
@@ -560,6 +587,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
560587
instance_types = args.instance_types
561588
namespace = args.namespace
562589
env = {}
590+
pull_secret = args.pull_secret
563591

564592
outfile = generate_appwrapper(
565593
name,
@@ -575,6 +603,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
575603
instascale,
576604
instance_types,
577605
env,
606+
pull_secret,
578607
)
579608
return outfile</code></pre>
580609
</details>
@@ -759,7 +788,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
759788
</details>
760789
</dd>
761790
<dt id="codeflare_sdk.utils.generate_yaml.update_nodes"><code class="name flex">
762-
<span>def <span class="ident">update_nodes</span></span>(<span>item, appwrapper_name, min_cpu, max_cpu, min_memory, max_memory, gpu, workers, image, instascale, env)</span>
791+
<span>def <span class="ident">update_nodes</span></span>(<span>item, appwrapper_name, min_cpu, max_cpu, min_memory, max_memory, gpu, workers, image, instascale, env, pull_secret)</span>
763792
</code></dt>
764793
<dd>
765794
<div class="desc"></div>
@@ -779,6 +808,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
779808
image,
780809
instascale,
781810
env,
811+
pull_secret,
782812
):
783813
if &#34;generictemplate&#34; in item.keys():
784814
head = item.get(&#34;generictemplate&#34;).get(&#34;spec&#34;).get(&#34;headGroupSpec&#34;)
@@ -794,6 +824,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
794824
for comp in [head, worker]:
795825
spec = comp.get(&#34;template&#34;).get(&#34;spec&#34;)
796826
update_affinity(spec, appwrapper_name, instascale)
827+
update_pull_secret(spec, pull_secret)
797828
update_image(spec, image)
798829
update_env(spec, env)
799830
if comp == head:
@@ -802,6 +833,22 @@ <h2 class="section-title" id="header-functions">Functions</h2>
802833
update_resources(spec, min_cpu, max_cpu, min_memory, max_memory, gpu)</code></pre>
803834
</details>
804835
</dd>
836+
<dt id="codeflare_sdk.utils.generate_yaml.update_pull_secret"><code class="name flex">
837+
<span>def <span class="ident">update_pull_secret</span></span>(<span>spec, pull_secret)</span>
838+
</code></dt>
839+
<dd>
840+
<div class="desc"></div>
841+
<details class="source">
842+
<summary>
843+
<span>Expand source code</span>
844+
</summary>
845+
<pre><code class="python">def update_pull_secret(spec, pull_secret):
846+
if pull_secret:
847+
if &#34;imagePullSecrets&#34; not in spec:
848+
spec[&#34;imagePullSecrets&#34;] = []
849+
spec[&#34;imagePullSecrets&#34;].append(pull_secret)</code></pre>
850+
</details>
851+
</dd>
805852
<dt id="codeflare_sdk.utils.generate_yaml.update_resources"><code class="name flex">
806853
<span>def <span class="ident">update_resources</span></span>(<span>spec, min_cpu, max_cpu, min_memory, max_memory, gpu)</span>
807854
</code></dt>
@@ -871,6 +918,7 @@ <h1>Index</h1>
871918
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_labels" href="#codeflare_sdk.utils.generate_yaml.update_labels">update_labels</a></code></li>
872919
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_names" href="#codeflare_sdk.utils.generate_yaml.update_names">update_names</a></code></li>
873920
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_nodes" href="#codeflare_sdk.utils.generate_yaml.update_nodes">update_nodes</a></code></li>
921+
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_pull_secret" href="#codeflare_sdk.utils.generate_yaml.update_pull_secret">update_pull_secret</a></code></li>
874922
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_resources" href="#codeflare_sdk.utils.generate_yaml.update_resources">update_resources</a></code></li>
875923
<li><code><a title="codeflare_sdk.utils.generate_yaml.write_user_appwrapper" href="#codeflare_sdk.utils.generate_yaml.write_user_appwrapper">write_user_appwrapper</a></code></li>
876924
</ul>

0 commit comments

Comments
 (0)