Skip to content

Commit 700d2b6

Browse files
committed
docs: update docs
1 parent 2a84103 commit 700d2b6

File tree

5 files changed

+76
-10
lines changed

5 files changed

+76
-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+
image_pull_secrets = self.config.image_pull_secrets
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+
image_pull_secrets=image_pull_secrets,
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+
image_pull_secrets = self.config.image_pull_secrets
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+
image_pull_secrets=image_pull_secrets,
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+
image_pull_secrets = self.config.image_pull_secrets
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+
image_pull_secrets=image_pull_secrets,
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/base-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+
image_pull_secrets: list = field(default_factory=list)</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 = '/home/meyceoz/Documents/codeflare-sdk/src/codeflare_sdk/templates/base-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/base-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', image_pull_secrets: list = &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/base-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+
image_pull_secrets: list = field(default_factory=list)</code></pre>
126129
</details>
127130
<h3>Class variables</h3>
128131
<dl>
@@ -142,6 +145,10 @@ <h3>Class variables</h3>
142145
<dd>
143146
<div class="desc"></div>
144147
</dd>
148+
<dt id="codeflare_sdk.cluster.config.ClusterConfiguration.image_pull_secrets"><code class="name">var <span class="ident">image_pull_secrets</span> : list</code></dt>
149+
<dd>
150+
<div class="desc"></div>
151+
</dd>
145152
<dt id="codeflare_sdk.cluster.config.ClusterConfiguration.instascale"><code class="name">var <span class="ident">instascale</span> : bool</code></dt>
146153
<dd>
147154
<div class="desc"></div>
@@ -211,6 +218,7 @@ <h4><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration" href="#co
211218
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.gpu" href="#codeflare_sdk.cluster.config.ClusterConfiguration.gpu">gpu</a></code></li>
212219
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.head_info" href="#codeflare_sdk.cluster.config.ClusterConfiguration.head_info">head_info</a></code></li>
213220
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.image" href="#codeflare_sdk.cluster.config.ClusterConfiguration.image">image</a></code></li>
221+
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.image_pull_secrets" href="#codeflare_sdk.cluster.config.ClusterConfiguration.image_pull_secrets">image_pull_secrets</a></code></li>
214222
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.instascale" href="#codeflare_sdk.cluster.config.ClusterConfiguration.instascale">instascale</a></code></li>
215223
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.machine_types" href="#codeflare_sdk.cluster.config.ClusterConfiguration.machine_types">machine_types</a></code></li>
216224
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.max_cpus" href="#codeflare_sdk.cluster.config.ClusterConfiguration.max_cpus">max_cpus</a></code></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:///home/meyceoz/Documents/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

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

163163

164+
def update_image_pull_secrets(spec, image_pull_secrets):
165+
if image_pull_secrets:
166+
if &#34;imagePullSecrets&#34; not in spec:
167+
spec[&#34;imagePullSecrets&#34;] = []
168+
for image_pull_secret in image_pull_secrets:
169+
spec[&#34;imagePullSecrets&#34;].append({&#34;name&#34;: image_pull_secret})
170+
171+
164172
def update_env(spec, env):
165173
containers = spec.get(&#34;containers&#34;)
166174
for container in containers:
@@ -198,6 +206,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
198206
image,
199207
instascale,
200208
env,
209+
image_pull_secrets,
201210
):
202211
if &#34;generictemplate&#34; in item.keys():
203212
head = item.get(&#34;generictemplate&#34;).get(&#34;spec&#34;).get(&#34;headGroupSpec&#34;)
@@ -213,6 +222,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
213222
for comp in [head, worker]:
214223
spec = comp.get(&#34;template&#34;).get(&#34;spec&#34;)
215224
update_affinity(spec, appwrapper_name, instascale)
225+
update_image_pull_secrets(spec, image_pull_secrets)
216226
update_image(spec, image)
217227
update_env(spec, env)
218228
if comp == head:
@@ -242,6 +252,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
242252
instascale: bool,
243253
instance_types: list,
244254
env,
255+
image_pull_secrets: list,
245256
):
246257
user_yaml = read_template(template)
247258
appwrapper_name, cluster_name = gen_names(name)
@@ -265,6 +276,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
265276
image,
266277
instascale,
267278
env,
279+
image_pull_secrets,
268280
)
269281
update_dashboard_route(route_item, cluster_name, namespace)
270282
outfile = appwrapper_name + &#34;.yaml&#34;
@@ -346,6 +358,12 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
346358
default=&#34;default&#34;,
347359
help=&#34;Set the kubernetes namespace you want to deploy your cluster to. Default. If left blank, uses the &#39;default&#39; namespace&#34;,
348360
)
361+
parser.add_argument(
362+
&#34;--image-pull-secrets&#34;,
363+
required=False,
364+
default=[],
365+
help=&#34;Set image pull secrets for private registries&#34;,
366+
)
349367

350368
args = parser.parse_args()
351369
name = args.name
@@ -361,6 +379,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
361379
instance_types = args.instance_types
362380
namespace = args.namespace
363381
env = {}
382+
image_pull_secrets = args.image_pull_secrets
364383

365384
outfile = generate_appwrapper(
366385
name,
@@ -376,6 +395,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
376395
instascale,
377396
instance_types,
378397
env,
398+
image_pull_secrets,
379399
)
380400
return outfile
381401

@@ -411,7 +431,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
411431
</details>
412432
</dd>
413433
<dt id="codeflare_sdk.utils.generate_yaml.generate_appwrapper"><code class="name flex">
414-
<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>
434+
<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, image_pull_secrets: list)</span>
415435
</code></dt>
416436
<dd>
417437
<div class="desc"></div>
@@ -433,6 +453,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
433453
instascale: bool,
434454
instance_types: list,
435455
env,
456+
image_pull_secrets: list,
436457
):
437458
user_yaml = read_template(template)
438459
appwrapper_name, cluster_name = gen_names(name)
@@ -456,6 +477,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
456477
image,
457478
instascale,
458479
env,
480+
image_pull_secrets,
459481
)
460482
update_dashboard_route(route_item, cluster_name, namespace)
461483
outfile = appwrapper_name + &#34;.yaml&#34;
@@ -546,6 +568,12 @@ <h2 class="section-title" id="header-functions">Functions</h2>
546568
default=&#34;default&#34;,
547569
help=&#34;Set the kubernetes namespace you want to deploy your cluster to. Default. If left blank, uses the &#39;default&#39; namespace&#34;,
548570
)
571+
parser.add_argument(
572+
&#34;--image-pull-secrets&#34;,
573+
required=False,
574+
default=[],
575+
help=&#34;Set image pull secrets for private registries&#34;,
576+
)
549577

550578
args = parser.parse_args()
551579
name = args.name
@@ -561,6 +589,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
561589
instance_types = args.instance_types
562590
namespace = args.namespace
563591
env = {}
592+
image_pull_secrets = args.image_pull_secrets
564593

565594
outfile = generate_appwrapper(
566595
name,
@@ -576,6 +605,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
576605
instascale,
577606
instance_types,
578607
env,
608+
image_pull_secrets,
579609
)
580610
return outfile</code></pre>
581611
</details>
@@ -715,6 +745,23 @@ <h2 class="section-title" id="header-functions">Functions</h2>
715745
container[&#34;image&#34;] = image</code></pre>
716746
</details>
717747
</dd>
748+
<dt id="codeflare_sdk.utils.generate_yaml.update_image_pull_secrets"><code class="name flex">
749+
<span>def <span class="ident">update_image_pull_secrets</span></span>(<span>spec, image_pull_secrets)</span>
750+
</code></dt>
751+
<dd>
752+
<div class="desc"></div>
753+
<details class="source">
754+
<summary>
755+
<span>Expand source code</span>
756+
</summary>
757+
<pre><code class="python">def update_image_pull_secrets(spec, image_pull_secrets):
758+
if image_pull_secrets:
759+
if &#34;imagePullSecrets&#34; not in spec:
760+
spec[&#34;imagePullSecrets&#34;] = []
761+
for image_pull_secret in image_pull_secrets:
762+
spec[&#34;imagePullSecrets&#34;].append({&#34;name&#34;: image_pull_secret})</code></pre>
763+
</details>
764+
</dd>
718765
<dt id="codeflare_sdk.utils.generate_yaml.update_labels"><code class="name flex">
719766
<span>def <span class="ident">update_labels</span></span>(<span>yaml, instascale, instance_types)</span>
720767
</code></dt>
@@ -760,7 +807,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
760807
</details>
761808
</dd>
762809
<dt id="codeflare_sdk.utils.generate_yaml.update_nodes"><code class="name flex">
763-
<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>
810+
<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, image_pull_secrets)</span>
764811
</code></dt>
765812
<dd>
766813
<div class="desc"></div>
@@ -780,6 +827,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
780827
image,
781828
instascale,
782829
env,
830+
image_pull_secrets,
783831
):
784832
if &#34;generictemplate&#34; in item.keys():
785833
head = item.get(&#34;generictemplate&#34;).get(&#34;spec&#34;).get(&#34;headGroupSpec&#34;)
@@ -795,6 +843,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
795843
for comp in [head, worker]:
796844
spec = comp.get(&#34;template&#34;).get(&#34;spec&#34;)
797845
update_affinity(spec, appwrapper_name, instascale)
846+
update_image_pull_secrets(spec, image_pull_secrets)
798847
update_image(spec, image)
799848
update_env(spec, env)
800849
if comp == head:
@@ -870,6 +919,7 @@ <h1>Index</h1>
870919
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_dashboard_route" href="#codeflare_sdk.utils.generate_yaml.update_dashboard_route">update_dashboard_route</a></code></li>
871920
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_env" href="#codeflare_sdk.utils.generate_yaml.update_env">update_env</a></code></li>
872921
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_image" href="#codeflare_sdk.utils.generate_yaml.update_image">update_image</a></code></li>
922+
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_image_pull_secrets" href="#codeflare_sdk.utils.generate_yaml.update_image_pull_secrets">update_image_pull_secrets</a></code></li>
873923
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_labels" href="#codeflare_sdk.utils.generate_yaml.update_labels">update_labels</a></code></li>
874924
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_names" href="#codeflare_sdk.utils.generate_yaml.update_names">update_names</a></code></li>
875925
<li><code><a title="codeflare_sdk.utils.generate_yaml.update_nodes" href="#codeflare_sdk.utils.generate_yaml.update_nodes">update_nodes</a></code></li>

0 commit comments

Comments
 (0)