Skip to content

Commit

Permalink
updates to version on release and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Sep 9, 2024
1 parent 24b5967 commit a78f9b3
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 38 deletions.
2 changes: 1 addition & 1 deletion bio_compose/_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.3
0.5.4
Binary file modified documentation/build/doctrees/bio_compose.doctree
Binary file not shown.
Binary file modified documentation/build/doctrees/environment.pickle
Binary file not shown.
29 changes: 25 additions & 4 deletions documentation/build/html/_modules/bio_compose.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ <h1>Source code for bio_compose</h1><div class="highlight"><pre>
<span class="n">current_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="vm">__file__</span><span class="p">)</span>
<span class="n">version_file_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">current_dir</span><span class="p">,</span> <span class="s1">&#39;_VERSION&#39;</span><span class="p">)</span>


<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">version_file_path</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>

Expand All @@ -96,6 +97,7 @@ <h1>Source code for bio_compose</h1><div class="highlight"><pre>
<span class="sd"> - 5 arguments(**sbml simulation only**): sbml filepath, simulation start, simulation end, simulation steps, simulator</span>

<span class="sd"> &quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">bio_compose.processing_tools</span> <span class="kn">import</span> <span class="n">get_job_signature</span>
<span class="kn">from</span> <span class="nn">bio_compose.runner</span> <span class="kn">import</span> <span class="n">SimulationRunner</span><span class="p">,</span> <span class="n">SimulationResult</span>

<span class="c1"># set up submission</span>
Expand All @@ -117,20 +119,24 @@ <h1>Source code for bio_compose</h1><div class="highlight"><pre>
<span class="n">simulator</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span>
<span class="n">submission</span> <span class="o">=</span> <span class="n">runner</span><span class="o">.</span><span class="n">run_utc_simulation</span><span class="p">(</span><span class="n">sbml_filepath</span><span class="o">=</span><span class="n">in_file</span><span class="p">,</span> <span class="n">start</span><span class="o">=</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="o">=</span><span class="n">end</span><span class="p">,</span> <span class="n">steps</span><span class="o">=</span><span class="n">steps</span><span class="p">,</span> <span class="n">simulator</span><span class="o">=</span><span class="n">simulator</span><span class="p">)</span>

<span class="c1"># fetch results</span>
<span class="c1"># fetch result params</span>
<span class="n">job_id</span> <span class="o">=</span> <span class="n">submission</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;job_id&#39;</span><span class="p">)</span>
<span class="n">output</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">timeout</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;timeout&#39;</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>

<span class="c1"># poll gateway for results</span>
<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">if</span> <span class="n">job_id</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;Submission Results for Job ID </span><span class="si">{</span><span class="n">job_id</span><span class="si">}</span><span class="s1">: &#39;</span><span class="p">)</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
<span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="n">timeout</span><span class="p">:</span>
<span class="k">break</span>
<span class="n">simulation_result</span> <span class="o">=</span> <span class="n">runner</span><span class="o">.</span><span class="n">get_output</span><span class="p">(</span><span class="n">job_id</span><span class="o">=</span><span class="n">job_id</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">simulation_result</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="n">status</span> <span class="o">=</span> <span class="n">simulation_result</span><span class="p">[</span><span class="s1">&#39;content&#39;</span><span class="p">][</span><span class="s1">&#39;status&#39;</span><span class="p">]</span>
<span class="n">last4</span> <span class="o">=</span> <span class="n">get_job_signature</span><span class="p">(</span><span class="n">job_id</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="s1">&#39;COMPLETED&#39;</span> <span class="ow">in</span> <span class="n">status</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Not complete: &#39;</span><span class="p">,</span> <span class="n">i</span><span class="p">,</span> <span class="n">status</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;Status for job ending in </span><span class="si">{</span><span class="n">last4</span><span class="si">}</span><span class="s1">: </span><span class="si">{</span><span class="n">status</span><span class="si">}</span><span class="s1">&#39;</span><span class="p">)</span>
<span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
Expand Down Expand Up @@ -160,6 +166,7 @@ <h1>Source code for bio_compose</h1><div class="highlight"><pre>
<span class="sd"> Returns:</span>
<span class="sd"> Verification result instance. See documentation for more details.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">bio_compose.processing_tools</span> <span class="kn">import</span> <span class="n">get_job_signature</span>
<span class="kn">from</span> <span class="nn">bio_compose.verifier</span> <span class="kn">import</span> <span class="n">Verifier</span><span class="p">,</span> <span class="n">VerificationResult</span>

<span class="n">verifier</span> <span class="o">=</span> <span class="n">Verifier</span><span class="p">()</span>
Expand All @@ -169,22 +176,36 @@ <h1>Source code for bio_compose</h1><div class="highlight"><pre>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="nb">int</span><span class="p">):</span>
<span class="n">run_sbml</span> <span class="o">=</span> <span class="kc">True</span>
<span class="n">submission</span> <span class="o">=</span> <span class="kc">None</span>

<span class="c1"># parse executor </span>
<span class="k">if</span> <span class="n">run_sbml</span><span class="p">:</span>
<span class="n">submission</span> <span class="o">=</span> <span class="n">verifier</span><span class="o">.</span><span class="n">verify_sbml</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">submission</span> <span class="o">=</span> <span class="n">verifier</span><span class="o">.</span><span class="n">verify_omex</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

<span class="c1"># fetch params</span>
<span class="n">job_id</span> <span class="o">=</span> <span class="n">submission</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;job_id&#39;</span><span class="p">)</span>
<span class="n">output</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">timeout</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;timeout&#39;</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
<span class="n">output</span> <span class="o">=</span> <span class="p">{}</span>

<span class="c1"># poll gateway for results</span>
<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">if</span> <span class="n">job_id</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;Submission Results for Job ID </span><span class="si">{</span><span class="n">job_id</span><span class="si">}</span><span class="s1">: &#39;</span><span class="p">)</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
<span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="n">timeout</span><span class="p">:</span>
<span class="k">break</span>
<span class="n">verification_result</span> <span class="o">=</span> <span class="n">verifier</span><span class="o">.</span><span class="n">get_output</span><span class="p">(</span><span class="n">job_id</span><span class="o">=</span><span class="n">job_id</span><span class="p">)</span>
<span class="n">status</span> <span class="o">=</span> <span class="n">verification_result</span><span class="p">[</span><span class="s1">&#39;content&#39;</span><span class="p">][</span><span class="s1">&#39;status&#39;</span><span class="p">]</span>
<span class="n">last4</span> <span class="o">=</span> <span class="n">get_job_signature</span><span class="p">(</span><span class="n">job_id</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="s1">&#39;COMPLETED&#39;</span> <span class="ow">in</span> <span class="n">status</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;Status for job ending in </span><span class="si">{</span><span class="n">last4</span><span class="si">}</span><span class="s1">: </span><span class="si">{</span><span class="n">status</span><span class="si">}</span><span class="s1">&#39;</span><span class="p">)</span>
<span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">output</span> <span class="o">=</span> <span class="n">verification_result</span>
<span class="k">break</span>

<span class="k">return</span> <span class="n">VerificationResult</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">output</span><span class="p">)</span></div>

</pre></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,13 @@ <h1>Source code for bio_compose.data_model</h1><div class="highlight"><pre>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="nd">@wraps</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">wrapper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="n">fig</span> <span class="o">=</span> <span class="n">func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="n">fig</span><span class="p">,</span> <span class="n">data</span> <span class="o">=</span> <span class="n">func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="n">save_dest</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;save_dest&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="k">if</span> <span class="n">save_dest</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">dest</span> <span class="o">=</span> <span class="n">save_dest</span> <span class="o">+</span> <span class="s1">&#39;.pdf&#39;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">export_plot</span><span class="p">(</span><span class="n">fig</span><span class="o">=</span><span class="n">fig</span><span class="p">,</span> <span class="n">save_dest</span><span class="o">=</span><span class="n">dest</span><span class="p">)</span>
<span class="k">return</span> <span class="n">data</span>

<span class="k">return</span> <span class="n">wrapper</span></div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">bio_compose</a></li>
</ul>

</div>
Expand All @@ -61,6 +62,7 @@
<ul class="wy-breadcrumbs">
<li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="../index.html">Module code</a></li>
<li class="breadcrumb-item"><a href="../bio_compose.html">bio_compose</a></li>
<li class="breadcrumb-item active">bio_compose.processing_tools</li>
<li class="wy-breadcrumbs-aside">
</li>
Expand Down Expand Up @@ -101,6 +103,13 @@ <h1>Source code for bio_compose.processing_tools</h1><div class="highlight"><pre
<span class="k">return</span> <span class="n">hex_colors</span></div>



<div class="viewcode-block" id="get_job_signature">
<a class="viewcode-back" href="../../bio_compose.html#bio_compose.processing_tools.get_job_signature">[docs]</a>
<span class="k">def</span> <span class="nf">get_job_signature</span><span class="p">(</span><span class="n">job_id</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="k">return</span> <span class="s2">&quot;&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">l</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">l</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">job_id</span><span class="p">)</span> <span class="k">if</span> <span class="n">i</span> <span class="o">&gt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">job_id</span><span class="p">)</span> <span class="o">-</span> <span class="mi">5</span><span class="p">])</span></div>


</pre></div>

</div>
Expand Down
Loading

0 comments on commit a78f9b3

Please sign in to comment.