Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dscc-admin-ch committed Jun 4, 2024
1 parent 20f4a11 commit a61b7ef
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 16 deletions.
28 changes: 26 additions & 2 deletions html/_modules/lomas_server/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ <h1>Source code for lomas_server.app</h1><div class="highlight"><pre>
<span class="c1"># Set some app state</span>
<span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">admin_database</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">query_handler</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dataset_store</span> <span class="o">=</span> <span class="kc">None</span>

<span class="c1"># General server state, can add fields if need be.</span>
<span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">server_state</span> <span class="o">=</span> <span class="p">{</span>
Expand Down Expand Up @@ -210,13 +211,13 @@ <h1>Source code for lomas_server.app</h1><div class="highlight"><pre>
<span class="k">if</span> <span class="n">status_ok</span><span class="p">:</span>
<span class="n">LOG</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Loading query handler&quot;</span><span class="p">)</span>
<span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">server_state</span><span class="p">[</span><span class="s2">&quot;message&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;Loading dataset store&quot;</span><span class="p">)</span>
<span class="n">dataset_store</span> <span class="o">=</span> <span class="n">dataset_store_factory</span><span class="p">(</span>
<span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dataset_store</span> <span class="o">=</span> <span class="n">dataset_store_factory</span><span class="p">(</span>
<span class="n">config</span><span class="o">.</span><span class="n">dataset_store</span><span class="p">,</span> <span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">admin_database</span>
<span class="p">)</span>

<span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">server_state</span><span class="p">[</span><span class="s2">&quot;message&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;Loading query handler&quot;</span><span class="p">)</span>
<span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">query_handler</span> <span class="o">=</span> <span class="n">QueryHandler</span><span class="p">(</span>
<span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">admin_database</span><span class="p">,</span> <span class="n">dataset_store</span>
<span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">admin_database</span><span class="p">,</span> <span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dataset_store</span>
<span class="p">)</span>

<span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">server_state</span><span class="p">[</span><span class="s2">&quot;state&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;Startup completed&quot;</span><span class="p">)</span>
Expand Down Expand Up @@ -296,6 +297,29 @@ <h1>Source code for lomas_server.app</h1><div class="highlight"><pre>



<div class="viewcode-block" id="get_memory_usage">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.app.get_memory_usage">[docs]</a>
<span class="nd">@app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span>
<span class="s2">&quot;/get_memory_usage&quot;</span><span class="p">,</span>
<span class="n">dependencies</span><span class="o">=</span><span class="p">[</span><span class="n">Depends</span><span class="p">(</span><span class="n">server_live</span><span class="p">)],</span>
<span class="n">tags</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;ADMIN_USER&quot;</span><span class="p">],</span>
<span class="p">)</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">get_memory_usage</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="n">JSONResponse</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Return the dataset store object memory usage</span>
<span class="sd"> Args:</span>
<span class="sd"> user_name (str, optional): The user name. Defaults to Header(None).</span>

<span class="sd"> Returns:</span>
<span class="sd"> JSONResponse: with DatasetStore object memory usage</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">JSONResponse</span><span class="p">(</span>
<span class="n">content</span><span class="o">=</span><span class="p">{</span>
<span class="s2">&quot;memory_usage&quot;</span><span class="p">:</span> <span class="n">app</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dataset_store</span><span class="o">.</span><span class="n">memory_usage</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">)</span></div>



<span class="c1"># Metadata query</span>
<div class="viewcode-block" id="get_dataset_metadata">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.app.get_dataset_metadata">[docs]</a>
Expand Down
8 changes: 6 additions & 2 deletions html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,14 @@ <h2 id="G">G</h2>
</li>
<li><a href="lomas_server.administration.html#lomas_server.administration.mongodb_admin.get_list_of_users">get_list_of_users() (in module lomas_server.administration.mongodb_admin)</a>
</li>
<li><a href="lomas_server.html#lomas_server.app.get_memory_usage">get_memory_usage() (in module lomas_server.app)</a>

<ul>
<li><a href="lomas_server.private_dataset.html#lomas_server.private_dataset.private_dataset.PrivateDataset.get_memory_usage">(lomas_server.private_dataset.private_dataset.PrivateDataset method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="lomas_server.private_dataset.html#lomas_server.private_dataset.private_dataset.PrivateDataset.get_memory_usage">get_memory_usage() (lomas_server.private_dataset.private_dataset.PrivateDataset method)</a>
</li>
<li><a href="lomas_server.private_dataset.html#lomas_server.private_dataset.private_dataset.PrivateDataset.get_metadata">get_metadata() (lomas_server.private_dataset.private_dataset.PrivateDataset method)</a>
</li>
<li><a href="lomas_server.admin_database.html#lomas_server.admin_database.utils.get_mongodb">get_mongodb() (in module lomas_server.admin_database.utils)</a>
Expand Down
16 changes: 16 additions & 0 deletions html/lomas_server.html
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,22 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lomas_server.app.get_memory_usage">
<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">lomas_server.app.</span></span><span class="sig-name descname"><span class="pre">get_memory_usage</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">JSONResponse</span></span></span><a class="reference internal" href="_modules/lomas_server/app.html#get_memory_usage"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#lomas_server.app.get_memory_usage" title="Link to this definition"></a></dt>
<dd><p>Return the dataset store object memory usage
:param user_name: The user name. Defaults to Header(None).
:type user_name: str, optional</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>with DatasetStore object memory usage</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p>JSONResponse</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lomas_server.app.get_remaining_budget">
<span class="sig-prename descclassname"><span class="pre">lomas_server.app.</span></span><span class="sig-name descname"><span class="pre">get_remaining_budget</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">_request</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Request</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">query_json</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="lomas_server.utils.html#lomas_server.utils.input_models.GetDbData" title="lomas_server.utils.input_models.GetDbData"><span class="pre">GetDbData</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">Body({'dataset_name':</span> <span class="pre">'PENGUIN'})</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">user_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">Header(None)</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">JSONResponse</span></span></span><a class="reference internal" href="_modules/lomas_server/app.html#get_remaining_budget"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#lomas_server.app.get_remaining_budget" title="Link to this definition"></a></dt>
Expand Down
8 changes: 4 additions & 4 deletions html/notebooks/demo_kubernetes_admin_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "82c43c2f",
"id": "d0b8dc2b",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -53,7 +53,7 @@
},
{
"cell_type": "markdown",
"id": "47cc9d15",
"id": "4e1de725",
"metadata": {},
"source": [
"#### Since the service has been deployed in the demo 1, the URL should be accessible."
Expand Down Expand Up @@ -392,7 +392,7 @@
},
{
"cell_type": "markdown",
"id": "c06e185e",
"id": "2b824e10",
"metadata": {},
"source": [
"### Archives of queries"
Expand All @@ -401,7 +401,7 @@
{
"cell_type": "code",
"execution_count": 11,
"id": "fe8ddd8d",
"id": "a59455e7",
"metadata": {},
"outputs": [
{
Expand Down
10 changes: 5 additions & 5 deletions html/notebooks/demo_kubernetes_deployment_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "35aaad76",
"id": "053f86b0",
"metadata": {},
"outputs": [
{
Expand All @@ -47,7 +47,7 @@
},
{
"cell_type": "markdown",
"id": "071b01ae",
"id": "202b4e77",
"metadata": {},
"source": [
"### Server"
Expand Down Expand Up @@ -254,7 +254,7 @@
},
{
"cell_type": "markdown",
"id": "09870244",
"id": "4211197d",
"metadata": {},
"source": [
"#### Update `values.yaml` file\n",
Expand Down Expand Up @@ -291,7 +291,7 @@
},
{
"cell_type": "markdown",
"id": "8c14dca1",
"id": "682dc4e1",
"metadata": {},
"source": [
"#### Access the client environment through the url and use the password defined in the values file."
Expand All @@ -308,7 +308,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "befa97f5",
"id": "ac325c27",
"metadata": {},
"outputs": [],
"source": [
Expand Down
4 changes: 2 additions & 2 deletions html/notebooks/kubernetes_deployment_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
},
{
"cell_type": "markdown",
"id": "1443f77d",
"id": "83252698",
"metadata": {},
"source": [
"Again, one needs to update the `values.yaml` file with the desired values. The important fields are `ingress.hosts[0].host` and `ingress.tls.hosts[0]` for the url, `password` for the user session and `image.repository` for specifying the previously built image. Make sure to change the `nameOverride`, `fullnameOverride` and url when deploying multiple client images.\n",
Expand All @@ -221,7 +221,7 @@
},
{
"cell_type": "markdown",
"id": "ccadf3d2",
"id": "d26ea20e",
"metadata": {},
"source": [
"The user session should now be available at the specified url, just type the password and you are in!\n",
Expand Down
Binary file modified html/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion html/searchindex.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions html/server_modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ <h1>lomas_server<a class="headerlink" href="#lomas-server" title="Link to this h
<li class="toctree-l3"><a class="reference internal" href="lomas_server.html#lomas_server.app.get_dataset_metadata"><code class="docutils literal notranslate"><span class="pre">get_dataset_metadata()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="lomas_server.html#lomas_server.app.get_dummy_dataset"><code class="docutils literal notranslate"><span class="pre">get_dummy_dataset()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="lomas_server.html#lomas_server.app.get_initial_budget"><code class="docutils literal notranslate"><span class="pre">get_initial_budget()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="lomas_server.html#lomas_server.app.get_memory_usage"><code class="docutils literal notranslate"><span class="pre">get_memory_usage()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="lomas_server.html#lomas_server.app.get_remaining_budget"><code class="docutils literal notranslate"><span class="pre">get_remaining_budget()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="lomas_server.html#lomas_server.app.get_state"><code class="docutils literal notranslate"><span class="pre">get_state()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="lomas_server.html#lomas_server.app.get_total_spent_budget"><code class="docutils literal notranslate"><span class="pre">get_total_spent_budget()</span></code></a></li>
Expand Down

0 comments on commit a61b7ef

Please sign in to comment.