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
95 changes: 32 additions & 63 deletions docs/detailed-documentation/cluster/cluster.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
if self._job_submission_client:
return self._job_submission_client
if is_openshift_cluster():
print(k8client.configuration.get_api_key_with_prefix(&#34;authorization&#34;))
self._job_submission_client = JobSubmissionClient(
self.cluster_dashboard_uri(),
headers=self._client_headers,
Expand Down Expand Up @@ -212,7 +211,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
mcad = self.config.mcad
instance_types = self.config.machine_types
env = self.config.envs
local_interactive = self.config.local_interactive
image_pull_secrets = self.config.image_pull_secrets
dispatch_priority = self.config.dispatch_priority
write_to_file = self.config.write_to_file
Expand All @@ -236,7 +234,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
mcad=mcad,
instance_types=instance_types,
env=env,
local_interactive=local_interactive,
image_pull_secrets=image_pull_secrets,
dispatch_priority=dispatch_priority,
priority_val=priority_val,
Expand Down Expand Up @@ -512,13 +509,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
verify_tls=True,
):
config_check()
if (
rc[&#34;metadata&#34;][&#34;annotations&#34;][&#34;sdk.codeflare.dev/local_interactive&#34;]
== &#34;True&#34;
):
local_interactive = True
else:
local_interactive = False
machine_types = (
rc[&#34;metadata&#34;][&#34;labels&#34;][&#34;orderedinstance&#34;].split(&#34;_&#34;)
if &#34;orderedinstance&#34; in rc[&#34;metadata&#34;][&#34;labels&#34;]
Expand Down Expand Up @@ -559,26 +549,34 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
image=rc[&#34;spec&#34;][&#34;workerGroupSpecs&#34;][0][&#34;template&#34;][&#34;spec&#34;][&#34;containers&#34;][
0
][&#34;image&#34;],
local_interactive=local_interactive,
mcad=mcad,
write_to_file=write_to_file,
verify_tls=verify_tls,
)
return Cluster(cluster_config)

def local_client_url(self):
if self.config.local_interactive == True:
ingress_domain = _get_ingress_domain(self)
return f&#34;ray://{ingress_domain}&#34;
else:
return &#34;None&#34;
ingress_domain = _get_ingress_domain(self)
return f&#34;ray://{ingress_domain}&#34;

def _component_resources_up(
self, namespace: str, api_instance: client.CustomObjectsApi
):
if self.config.write_to_file:
with open(self.app_wrapper_yaml) as f:
yamls = yaml.load_all(f, Loader=yaml.FullLoader)
yamls = list(yaml.load_all(f, Loader=yaml.FullLoader))
for resource in yamls:
enable_ingress = (
resource.get(&#34;spec&#34;, {})
.get(&#34;headGroupSpec&#34;, {})
.get(&#34;enableIngress&#34;)
)
if resource[&#34;kind&#34;] == &#34;RayCluster&#34; and enable_ingress is not False:
name = resource[&#34;metadata&#34;][&#34;name&#34;]
print(
f&#34;Forbidden: RayCluster &#39;{name}&#39; has &#39;enableIngress&#39; set to &#39;True&#39; or is unset.&#34;
)
return
_create_resources(yamls, namespace, api_instance)
else:
yamls = yaml.load_all(self.app_wrapper_yaml, Loader=yaml.FullLoader)
Expand Down Expand Up @@ -699,13 +697,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
plural=&#34;rayclusters&#34;,
name=name,
)
elif resource[&#34;kind&#34;] == &#34;Secret&#34;:
name = resource[&#34;metadata&#34;][&#34;name&#34;]
secret_instance = client.CoreV1Api(api_config_handler())
secret_instance.delete_namespaced_secret(
namespace=namespace,
name=name,
)


def _create_resources(yamls, namespace: str, api_instance: client.CustomObjectsApi):
Expand All @@ -718,12 +709,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
plural=&#34;rayclusters&#34;,
body=resource,
)
elif resource[&#34;kind&#34;] == &#34;Secret&#34;:
secret_instance = client.CoreV1Api(api_config_handler())
secret_instance.create_namespaced_secret(
namespace=namespace,
body=resource,
)


def _check_aw_exists(name: str, namespace: str) -&gt; bool:
Expand Down Expand Up @@ -1185,7 +1170,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
if self._job_submission_client:
return self._job_submission_client
if is_openshift_cluster():
print(k8client.configuration.get_api_key_with_prefix(&#34;authorization&#34;))
self._job_submission_client = JobSubmissionClient(
self.cluster_dashboard_uri(),
headers=self._client_headers,
Expand Down Expand Up @@ -1276,7 +1260,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
mcad = self.config.mcad
instance_types = self.config.machine_types
env = self.config.envs
local_interactive = self.config.local_interactive
image_pull_secrets = self.config.image_pull_secrets
dispatch_priority = self.config.dispatch_priority
write_to_file = self.config.write_to_file
Expand All @@ -1300,7 +1283,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
mcad=mcad,
instance_types=instance_types,
env=env,
local_interactive=local_interactive,
image_pull_secrets=image_pull_secrets,
dispatch_priority=dispatch_priority,
priority_val=priority_val,
Expand Down Expand Up @@ -1576,13 +1558,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
verify_tls=True,
):
config_check()
if (
rc[&#34;metadata&#34;][&#34;annotations&#34;][&#34;sdk.codeflare.dev/local_interactive&#34;]
== &#34;True&#34;
):
local_interactive = True
else:
local_interactive = False
machine_types = (
rc[&#34;metadata&#34;][&#34;labels&#34;][&#34;orderedinstance&#34;].split(&#34;_&#34;)
if &#34;orderedinstance&#34; in rc[&#34;metadata&#34;][&#34;labels&#34;]
Expand Down Expand Up @@ -1623,26 +1598,34 @@ <h2 class="section-title" id="header-classes">Classes</h2>
image=rc[&#34;spec&#34;][&#34;workerGroupSpecs&#34;][0][&#34;template&#34;][&#34;spec&#34;][&#34;containers&#34;][
0
][&#34;image&#34;],
local_interactive=local_interactive,
mcad=mcad,
write_to_file=write_to_file,
verify_tls=verify_tls,
)
return Cluster(cluster_config)

def local_client_url(self):
if self.config.local_interactive == True:
ingress_domain = _get_ingress_domain(self)
return f&#34;ray://{ingress_domain}&#34;
else:
return &#34;None&#34;
ingress_domain = _get_ingress_domain(self)
return f&#34;ray://{ingress_domain}&#34;

def _component_resources_up(
self, namespace: str, api_instance: client.CustomObjectsApi
):
if self.config.write_to_file:
with open(self.app_wrapper_yaml) as f:
yamls = yaml.load_all(f, Loader=yaml.FullLoader)
yamls = list(yaml.load_all(f, Loader=yaml.FullLoader))
for resource in yamls:
enable_ingress = (
resource.get(&#34;spec&#34;, {})
.get(&#34;headGroupSpec&#34;, {})
.get(&#34;enableIngress&#34;)
)
if resource[&#34;kind&#34;] == &#34;RayCluster&#34; and enable_ingress is not False:
name = resource[&#34;metadata&#34;][&#34;name&#34;]
print(
f&#34;Forbidden: RayCluster &#39;{name}&#39; has &#39;enableIngress&#39; set to &#39;True&#39; or is unset.&#34;
)
return
_create_resources(yamls, namespace, api_instance)
else:
yamls = yaml.load_all(self.app_wrapper_yaml, Loader=yaml.FullLoader)
Expand Down Expand Up @@ -1675,7 +1658,6 @@ <h3>Instance variables</h3>
if self._job_submission_client:
return self._job_submission_client
if is_openshift_cluster():
print(k8client.configuration.get_api_key_with_prefix(&#34;authorization&#34;))
self._job_submission_client = JobSubmissionClient(
self.cluster_dashboard_uri(),
headers=self._client_headers,
Expand Down Expand Up @@ -1824,7 +1806,6 @@ <h3>Methods</h3>
mcad = self.config.mcad
instance_types = self.config.machine_types
env = self.config.envs
local_interactive = self.config.local_interactive
image_pull_secrets = self.config.image_pull_secrets
dispatch_priority = self.config.dispatch_priority
write_to_file = self.config.write_to_file
Expand All @@ -1848,7 +1829,6 @@ <h3>Methods</h3>
mcad=mcad,
instance_types=instance_types,
env=env,
local_interactive=local_interactive,
image_pull_secrets=image_pull_secrets,
dispatch_priority=dispatch_priority,
priority_val=priority_val,
Expand Down Expand Up @@ -1953,13 +1933,6 @@ <h3>Methods</h3>
verify_tls=True,
):
config_check()
if (
rc[&#34;metadata&#34;][&#34;annotations&#34;][&#34;sdk.codeflare.dev/local_interactive&#34;]
== &#34;True&#34;
):
local_interactive = True
else:
local_interactive = False
machine_types = (
rc[&#34;metadata&#34;][&#34;labels&#34;][&#34;orderedinstance&#34;].split(&#34;_&#34;)
if &#34;orderedinstance&#34; in rc[&#34;metadata&#34;][&#34;labels&#34;]
Expand Down Expand Up @@ -2000,7 +1973,6 @@ <h3>Methods</h3>
image=rc[&#34;spec&#34;][&#34;workerGroupSpecs&#34;][0][&#34;template&#34;][&#34;spec&#34;][&#34;containers&#34;][
0
][&#34;image&#34;],
local_interactive=local_interactive,
mcad=mcad,
write_to_file=write_to_file,
verify_tls=verify_tls,
Expand Down Expand Up @@ -2092,11 +2064,8 @@ <h3>Methods</h3>
<span>Expand source code</span>
</summary>
<pre><code class="python">def local_client_url(self):
if self.config.local_interactive == True:
ingress_domain = _get_ingress_domain(self)
return f&#34;ray://{ingress_domain}&#34;
else:
return &#34;None&#34;</code></pre>
ingress_domain = _get_ingress_domain(self)
return f&#34;ray://{ingress_domain}&#34;</code></pre>
</details>
</dd>
<dt id="codeflare_sdk.cluster.cluster.Cluster.status"><code class="name flex">
Expand Down
9 changes: 1 addition & 8 deletions docs/detailed-documentation/cluster/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.config</code></h1>
mcad: bool = False
envs: dict = field(default_factory=dict)
image: str = &#34;&#34;
local_interactive: bool = False
image_pull_secrets: list = field(default_factory=list)
dispatch_priority: str = None
write_to_file: bool = False
Expand All @@ -107,7 +106,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<dl>
<dt id="codeflare_sdk.cluster.config.ClusterConfiguration"><code class="flex name class">
<span>class <span class="ident">ClusterConfiguration</span></span>
<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 = False, envs: dict = &lt;factory&gt;, image: str = '', local_interactive: bool = False, image_pull_secrets: list = &lt;factory&gt;, dispatch_priority: str = None, write_to_file: bool = False, verify_tls: bool = True, local_queue: str = None)</span>
<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 = False, envs: dict = &lt;factory&gt;, image: str = '', image_pull_secrets: list = &lt;factory&gt;, dispatch_priority: str = None, write_to_file: bool = False, verify_tls: bool = True, local_queue: str = None)</span>
</code></dt>
<dd>
<div class="desc"><p>This dataclass is used to specify resource requirements and other details, and
Expand Down Expand Up @@ -140,7 +139,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
mcad: bool = False
envs: dict = field(default_factory=dict)
image: str = &#34;&#34;
local_interactive: bool = False
image_pull_secrets: list = field(default_factory=list)
dispatch_priority: str = None
write_to_file: bool = False
Expand Down Expand Up @@ -192,10 +190,6 @@ <h3>Class variables</h3>
<dd>
<div class="desc"></div>
</dd>
<dt id="codeflare_sdk.cluster.config.ClusterConfiguration.local_interactive"><code class="name">var <span class="ident">local_interactive</span> : bool</code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="codeflare_sdk.cluster.config.ClusterConfiguration.local_queue"><code class="name">var <span class="ident">local_queue</span> : str</code></dt>
<dd>
<div class="desc"></div>
Expand Down Expand Up @@ -282,7 +276,6 @@ <h4><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration" href="#co
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.image" href="#codeflare_sdk.cluster.config.ClusterConfiguration.image">image</a></code></li>
<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>
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.instascale" href="#codeflare_sdk.cluster.config.ClusterConfiguration.instascale">instascale</a></code></li>
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.local_interactive" href="#codeflare_sdk.cluster.config.ClusterConfiguration.local_interactive">local_interactive</a></code></li>
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.local_queue" href="#codeflare_sdk.cluster.config.ClusterConfiguration.local_queue">local_queue</a></code></li>
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.machine_types" href="#codeflare_sdk.cluster.config.ClusterConfiguration.machine_types">machine_types</a></code></li>
<li><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration.max_cpus" href="#codeflare_sdk.cluster.config.ClusterConfiguration.max_cpus">max_cpus</a></code></li>
Expand Down
Loading