Skip to content

Commit

Permalink
Update docs, demos, and version (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxusmusti authored Mar 6, 2023
1 parent a49602e commit fb49dc5
Show file tree
Hide file tree
Showing 9 changed files with 721 additions and 298 deletions.
53 changes: 47 additions & 6 deletions demo-notebooks/batch-job/batch_mnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
" token = \"XXXX\",\n",
" server = \"XXXX\",\n",
" skip_tls=True\n",
")"
")\n",
"auth.login()"
]
},
{
Expand All @@ -43,7 +44,7 @@
"outputs": [],
"source": [
"# Create our cluster and submit appwrapper\n",
"cluster = Cluster(ClusterConfiguration(name='mnisttest', min_worker=2, max_worker=2, min_cpus=8, max_cpus=8, min_memory=16, max_memory=16, gpu=4, instascale=True, machine_types=[\"m5.xlarge\", \"p3.8xlarge\"], auth=auth))"
"cluster = Cluster(ClusterConfiguration(name='mnisttest', min_worker=2, max_worker=2, min_cpus=8, max_cpus=8, min_memory=16, max_memory=16, gpu=4, instascale=True, machine_types=[\"m5.xlarge\", \"p3.8xlarge\"]))"
]
},
{
Expand All @@ -66,11 +67,12 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "657ebdfb",
"metadata": {},
"source": [
"Now, we want to check on the status of our resource cluster, until it is finally ready for use."
"Now, we want to check on the status of our resource cluster, and wait until it is finally ready for use."
]
},
{
Expand Down Expand Up @@ -122,7 +124,36 @@
}
],
"source": [
"cluster.is_ready()"
"cluster.status()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a99d5aff",
"metadata": {},
"outputs": [],
"source": [
"cluster.wait_ready()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "df71c1ed",
"metadata": {},
"outputs": [],
"source": [
"cluster.status()"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "b3a55fe4",
"metadata": {},
"source": [
"Let's quickly verify that the specs of the cluster are as expected."
]
},
{
Expand Down Expand Up @@ -190,7 +221,7 @@
}
],
"source": [
"cluster.status()"
"cluster.details()"
]
},
{
Expand Down Expand Up @@ -1994,6 +2025,16 @@
"source": [
"cluster.down()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0d41b90e",
"metadata": {},
"outputs": [],
"source": [
"auth.logout()"
]
}
],
"metadata": {
Expand All @@ -2012,7 +2053,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.9.13"
},
"vscode": {
"interpreter": {
Expand Down
55 changes: 48 additions & 7 deletions demo-notebooks/interactive/hf_interactive.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@
"metadata": {},
"outputs": [],
"source": [
"# Create authentication object for oc user permissions\n",
"# Create authentication object for oc user permissions and login\n",
"auth = TokenAuthentication(\n",
" token = \"XXXX\",\n",
" server = \"XXXX\",\n",
" skip_tls = True\n",
")"
")\n",
"auth.login()"
]
},
{
Expand All @@ -85,7 +86,7 @@
],
"source": [
"# Create our cluster and submit appwrapper\n",
"cluster = Cluster(ClusterConfiguration(name='hfgputest', min_worker=1, max_worker=1, min_cpus=8, max_cpus=8, min_memory=16, max_memory=16, gpu=4, instascale=True, machine_types=[\"m5.xlarge\", \"p3.8xlarge\"], auth=auth))"
"cluster = Cluster(ClusterConfiguration(name='hfgputest', min_worker=1, max_worker=1, min_cpus=8, max_cpus=8, min_memory=16, max_memory=16, gpu=4, instascale=True, machine_types=[\"m5.xlarge\", \"p3.8xlarge\"]))"
]
},
{
Expand All @@ -107,11 +108,12 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "657ebdfb",
"metadata": {},
"source": [
"Now, we want to check on the status of our resource cluster, until it is finally ready for use."
"Now, we want to check on the initial status of our resource cluster, then wait until it is finally ready for use."
]
},
{
Expand Down Expand Up @@ -163,7 +165,36 @@
}
],
"source": [
"cluster.is_ready()"
"cluster.status()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1d26275e",
"metadata": {},
"outputs": [],
"source": [
"cluster.wait_ready()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d2969a4b",
"metadata": {},
"outputs": [],
"source": [
"cluster.status()"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "477ac246",
"metadata": {},
"source": [
"Let's quickly verify that the specs of the cluster are as expected."
]
},
{
Expand Down Expand Up @@ -231,7 +262,7 @@
}
],
"source": [
"cluster.status()"
"cluster.details()"
]
},
{
Expand Down Expand Up @@ -1379,6 +1410,16 @@
"cluster.down()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "61bf4946",
"metadata": {},
"outputs": [],
"source": [
"auth.logout()"
]
},
{
"cell_type": "markdown",
"id": "2b7a183b-5e8e-4adb-b9a6-a349e13512a0",
Expand Down Expand Up @@ -1416,7 +1457,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.9.13"
},
"vscode": {
"interpreter": {
Expand Down
47 changes: 28 additions & 19 deletions docs/cluster/auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.auth</code></h1>
self.server = server
self.skip_tls = skip_tls

def login(self):
def login(self) -&gt; str:
&#34;&#34;&#34;
This function is used to login to an OpenShift cluster using the user&#39;s API token and API server address.
Depending on the cluster, a user can choose to login in with &#34;--insecure-skip-tls-verify` by setting `skip_tls`
Expand All @@ -107,15 +107,18 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.auth</code></h1>
error_msg = osp.result.err()
if &#34;The server uses a certificate signed by unknown authority&#34; in error_msg:
return &#34;Error: certificate auth failure, please set `skip_tls=True` in TokenAuthentication&#34;
elif &#34;invalid&#34; in error_msg:
raise PermissionError(error_msg)
else:
return error_msg
return response.out()

def logout(self):
def logout(self) -&gt; str:
&#34;&#34;&#34;
This function is used to logout of an OpenShift cluster.
&#34;&#34;&#34;
response = oc.invoke(&#34;logout&#34;)
args = [f&#34;--token={self.token}&#34;, f&#34;--server={self.server}:6443&#34;]
response = oc.invoke(&#34;logout&#34;, args)
return response.out()


Expand All @@ -137,14 +140,14 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.auth</code></h1>
self.username = username
self.password = password

def login(self):
def login(self) -&gt; str:
&#34;&#34;&#34;
This function is used to login to an OpenShift cluster using the user&#39;s `username` and `password`.
&#34;&#34;&#34;
response = oc.login(self.username, self.password)
return response.out()

def logout(self):
def logout(self) -&gt; str:
&#34;&#34;&#34;
This function is used to logout of an OpenShift cluster.
&#34;&#34;&#34;
Expand Down Expand Up @@ -261,14 +264,14 @@ <h3>Methods</h3>
self.username = username
self.password = password

def login(self):
def login(self) -&gt; str:
&#34;&#34;&#34;
This function is used to login to an OpenShift cluster using the user&#39;s `username` and `password`.
&#34;&#34;&#34;
response = oc.login(self.username, self.password)
return response.out()

def logout(self):
def logout(self) -&gt; str:
&#34;&#34;&#34;
This function is used to logout of an OpenShift cluster.
&#34;&#34;&#34;
Expand All @@ -282,15 +285,15 @@ <h3>Ancestors</h3>
<h3>Methods</h3>
<dl>
<dt id="codeflare_sdk.cluster.auth.PasswordUserAuthentication.login"><code class="name flex">
<span>def <span class="ident">login</span></span>(<span>self)</span>
<span>def <span class="ident">login</span></span>(<span>self)> str</span>
</code></dt>
<dd>
<div class="desc"><p>This function is used to login to an OpenShift cluster using the user's <code>username</code> and <code>password</code>.</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def login(self):
<pre><code class="python">def login(self) -&gt; str:
&#34;&#34;&#34;
This function is used to login to an OpenShift cluster using the user&#39;s `username` and `password`.
&#34;&#34;&#34;
Expand All @@ -299,15 +302,15 @@ <h3>Methods</h3>
</details>
</dd>
<dt id="codeflare_sdk.cluster.auth.PasswordUserAuthentication.logout"><code class="name flex">
<span>def <span class="ident">logout</span></span>(<span>self)</span>
<span>def <span class="ident">logout</span></span>(<span>self)> str</span>
</code></dt>
<dd>
<div class="desc"><p>This function is used to logout of an OpenShift cluster.</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def logout(self):
<pre><code class="python">def logout(self) -&gt; str:
&#34;&#34;&#34;
This function is used to logout of an OpenShift cluster.
&#34;&#34;&#34;
Expand Down Expand Up @@ -346,7 +349,7 @@ <h3>Methods</h3>
self.server = server
self.skip_tls = skip_tls

def login(self):
def login(self) -&gt; str:
&#34;&#34;&#34;
This function is used to login to an OpenShift cluster using the user&#39;s API token and API server address.
Depending on the cluster, a user can choose to login in with &#34;--insecure-skip-tls-verify` by setting `skip_tls`
Expand All @@ -361,15 +364,18 @@ <h3>Methods</h3>
error_msg = osp.result.err()
if &#34;The server uses a certificate signed by unknown authority&#34; in error_msg:
return &#34;Error: certificate auth failure, please set `skip_tls=True` in TokenAuthentication&#34;
elif &#34;invalid&#34; in error_msg:
raise PermissionError(error_msg)
else:
return error_msg
return response.out()

def logout(self):
def logout(self) -&gt; str:
&#34;&#34;&#34;
This function is used to logout of an OpenShift cluster.
&#34;&#34;&#34;
response = oc.invoke(&#34;logout&#34;)
args = [f&#34;--token={self.token}&#34;, f&#34;--server={self.server}:6443&#34;]
response = oc.invoke(&#34;logout&#34;, args)
return response.out()</code></pre>
</details>
<h3>Ancestors</h3>
Expand All @@ -379,7 +385,7 @@ <h3>Ancestors</h3>
<h3>Methods</h3>
<dl>
<dt id="codeflare_sdk.cluster.auth.TokenAuthentication.login"><code class="name flex">
<span>def <span class="ident">login</span></span>(<span>self)</span>
<span>def <span class="ident">login</span></span>(<span>self)> str</span>
</code></dt>
<dd>
<div class="desc"><p>This function is used to login to an OpenShift cluster using the user's API token and API server address.
Expand All @@ -389,7 +395,7 @@ <h3>Methods</h3>
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def login(self):
<pre><code class="python">def login(self) -&gt; str:
&#34;&#34;&#34;
This function is used to login to an OpenShift cluster using the user&#39;s API token and API server address.
Depending on the cluster, a user can choose to login in with &#34;--insecure-skip-tls-verify` by setting `skip_tls`
Expand All @@ -404,25 +410,28 @@ <h3>Methods</h3>
error_msg = osp.result.err()
if &#34;The server uses a certificate signed by unknown authority&#34; in error_msg:
return &#34;Error: certificate auth failure, please set `skip_tls=True` in TokenAuthentication&#34;
elif &#34;invalid&#34; in error_msg:
raise PermissionError(error_msg)
else:
return error_msg
return response.out()</code></pre>
</details>
</dd>
<dt id="codeflare_sdk.cluster.auth.TokenAuthentication.logout"><code class="name flex">
<span>def <span class="ident">logout</span></span>(<span>self)</span>
<span>def <span class="ident">logout</span></span>(<span>self)> str</span>
</code></dt>
<dd>
<div class="desc"><p>This function is used to logout of an OpenShift cluster.</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def logout(self):
<pre><code class="python">def logout(self) -&gt; str:
&#34;&#34;&#34;
This function is used to logout of an OpenShift cluster.
&#34;&#34;&#34;
response = oc.invoke(&#34;logout&#34;)
args = [f&#34;--token={self.token}&#34;, f&#34;--server={self.server}:6443&#34;]
response = oc.invoke(&#34;logout&#34;, args)
return response.out()</code></pre>
</details>
</dd>
Expand Down
Loading

0 comments on commit fb49dc5

Please sign in to comment.