Skip to content

Commit

Permalink
deploy: 6bf69e8
Browse files Browse the repository at this point in the history
  • Loading branch information
limx0 committed Jun 8, 2024
1 parent 45f9169 commit 09062b1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 44 deletions.
52 changes: 32 additions & 20 deletions 2_user_guide/usage.html
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,17 @@ <h2>Cache instances<a class="headerlink" href="#cache-instances" title="Link to
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
<span class="ne">TypeError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
<span class="n">Cell</span> <span class="n">In</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">line</span> <span class="mi">3</span>
<span class="g g-Whitespace"> </span><span class="mi">1</span> <span class="kn">from</span> <span class="nn">deche</span> <span class="kn">import</span> <span class="n">Cache</span>
<span class="ne">----&gt; </span><span class="mi">3</span> <span class="n">cache</span> <span class="o">=</span> <span class="n">Cache</span><span class="p">(</span><span class="n">fs_protocol</span><span class="o">=</span><span class="s2">&quot;memory&quot;</span><span class="p">)</span>

<span class="ne">TypeError</span>: Cache.__init__() missing 1 required positional argument: &#39;prefix&#39;
</pre></div>
</div>
</div>
</div>
</section>
<section id="using-deche">
Expand Down Expand Up @@ -492,7 +503,7 @@ <h2>Using deche<a class="headerlink" href="#using-deche" title="Link to this hea
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 1.15 ms, sys: 259 µs, total: 1.41 ms
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 1.98 ms, sys: 356 µs, total: 2.33 ms
Wall time: 1 s
</pre></div>
</div>
Expand All @@ -508,8 +519,8 @@ <h2>Using deche<a class="headerlink" href="#using-deche" title="Link to this hea
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 180 µs, sys: 0 ns, total: 180 µs
Wall time: 183 µs
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 90 µs, sys: 16 µs, total: 106 µs
Wall time: 108 µs
</pre></div>
</div>
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2
Expand All @@ -524,7 +535,7 @@ <h2>Using deche<a class="headerlink" href="#using-deche" title="Link to this hea
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&#39;d0fab86955c160fabec5b0dbea0eb77f85d2327af9475841044b337d3d49e775&#39;]
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&#39;645076b4c840c53438b6eec928fee62ea2e2f700b62bcf2efb030766341c5113&#39;]
</pre></div>
</div>
</div>
Expand All @@ -546,9 +557,9 @@ <h2>Whats happening under the hood?<a class="headerlink" href="#whats-happening-
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>03fdb2798356d6e4e55bd7fdb8c07bb0eae61d38abe3840f7f611df560a7bd1b
03fdb2798356d6e4e55bd7fdb8c07bb0eae61d38abe3840f7f611df560a7bd1b
03fdb2798356d6e4e55bd7fdb8c07bb0eae61d38abe3840f7f611df560a7bd1b
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2a8dafae61fc6a537258ca1909b5db314e584b8596cca0c3a9d0c0624e81caa6
2a8dafae61fc6a537258ca1909b5db314e584b8596cca0c3a9d0c0624e81caa6
2a8dafae61fc6a537258ca1909b5db314e584b8596cca0c3a9d0c0624e81caa6
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -629,23 +640,24 @@ <h2>Return values (including exceptions) are cached<a class="headerlink" href="#
<div class="cell_output docutils container">
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
<span class="ne">ZeroDivisionError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
<span class="n">Cell</span> <span class="n">In</span><span class="p">[</span><span class="mi">12</span><span class="p">],</span> <span class="n">line</span> <span class="mi">1</span>
<span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">ipykernel_1020930</span><span class="o">/</span><span class="mf">2118990485.</span><span class="n">py</span> <span class="ow">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
<span class="ne">----&gt; </span><span class="mi">1</span> <span class="n">divide_by</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>

<span class="nn">File ~/work/deche/deche/deche/core.py:336,</span> in <span class="ni">Cache.__call__.&lt;locals&gt;.wrapper</span><span class="nt">(*args, **kwargs)</span>
<span class="g g-Whitespace"> </span><span class="mi">334</span> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Function </span><span class="si">{</span><span class="n">func</span><span class="si">}</span><span class="s2"> raised </span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">335</span> <span class="bp">self</span><span class="o">.</span><span class="n">write_output</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">path</span><span class="si">}</span><span class="s2">/</span><span class="si">{</span><span class="n">key</span><span class="si">}{</span><span class="n">Extensions</span><span class="o">.</span><span class="n">exception</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">output</span><span class="o">=</span><span class="n">e</span><span class="p">)</span>
<span class="ne">--&gt; </span><span class="mi">336</span> <span class="k">raise</span> <span class="n">e</span>
<span class="g g-Whitespace"> </span><span class="mi">338</span> <span class="k">return</span> <span class="n">output</span>
<span class="nn">~/projects/deche/deche/core.py</span> in <span class="ni">wrapper</span><span class="nt">(*args, **kwargs)</span>
<span class="g g-Whitespace"> </span><span class="mi">327</span> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Function </span><span class="si">{</span><span class="n">func</span><span class="si">}</span><span class="s2"> raised </span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">328</span> <span class="bp">self</span><span class="o">.</span><span class="n">write_output</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">path</span><span class="si">}</span><span class="s2">/</span><span class="si">{</span><span class="n">key</span><span class="si">}{</span><span class="n">Extensions</span><span class="o">.</span><span class="n">exception</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">output</span><span class="o">=</span><span class="n">e</span><span class="p">)</span>
<span class="ne">--&gt; </span><span class="mi">329</span> <span class="k">raise</span> <span class="n">e</span>
<span class="g g-Whitespace"> </span><span class="mi">330</span>
<span class="g g-Whitespace"> </span><span class="mi">331</span> <span class="k">return</span> <span class="n">output</span>

<span class="nn">File ~/work/deche/deche/deche/core.py:324,</span> in <span class="ni">Cache.__call__.&lt;locals&gt;.wrapper</span><span class="nt">(*args, **kwargs)</span>
<span class="g g-Whitespace"> </span><span class="mi">322</span> <span class="bp">self</span><span class="o">.</span><span class="n">write_input</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">path</span><span class="si">}</span><span class="s2">/</span><span class="si">{</span><span class="n">key</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">inputs</span><span class="o">=</span><span class="n">inputs</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">323</span> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Calling </span><span class="si">{</span><span class="n">func</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="ne">--&gt; </span><span class="mi">324</span> <span class="n">output</span> <span class="o">=</span> <span class="n">func</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="g g-Whitespace"> </span><span class="mi">325</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">result_validator</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="g g-Whitespace"> </span><span class="mi">326</span> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Validating result with </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">result_validator</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="nn">~/projects/deche/deche/core.py</span> in <span class="ni">wrapper</span><span class="nt">(*args, **kwargs)</span>
<span class="g g-Whitespace"> </span><span class="mi">321</span> <span class="bp">self</span><span class="o">.</span><span class="n">write_input</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">path</span><span class="si">}</span><span class="s2">/</span><span class="si">{</span><span class="n">key</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">inputs</span><span class="o">=</span><span class="n">inputs</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">322</span> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Calling </span><span class="si">{</span><span class="n">func</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="ne">--&gt; </span><span class="mi">323</span> <span class="n">output</span> <span class="o">=</span> <span class="n">func</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="g g-Whitespace"> </span><span class="mi">324</span> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Function </span><span class="si">{</span><span class="n">func</span><span class="si">}</span><span class="s2"> ran successfully&quot;</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">325</span> <span class="bp">self</span><span class="o">.</span><span class="n">write_output</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">path</span><span class="si">}</span><span class="s2">/</span><span class="si">{</span><span class="n">key</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">output</span><span class="o">=</span><span class="n">output</span><span class="p">)</span>

<span class="nn">Cell In[7], line 7,</span> in <span class="ni">divide_by</span><span class="nt">(n)</span>
<span class="nn">/tmp/ipykernel_1020930/121188569.py</span> in <span class="ni">divide_by</span><span class="nt">(n)</span>
<span class="g g-Whitespace"> </span><span class="mi">5</span> <span class="nd">@cache</span>
<span class="g g-Whitespace"> </span><span class="mi">6</span> <span class="k">def</span> <span class="nf">divide_by</span><span class="p">(</span><span class="n">n</span><span class="p">):</span>
<span class="ne">----&gt; </span><span class="mi">7</span> <span class="k">return</span> <span class="mi">1</span><span class="o">/</span><span class="n">n</span>
Expand Down
31 changes: 8 additions & 23 deletions reports/2_user_guide/usage.err.log
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,17 @@ Traceback (most recent call last):
raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
------------------
divide_by(0)
from deche import Cache

cache = Cache(fs_protocol="memory")
------------------


---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
Cell In[12], line 1
----> 1 divide_by(0)

File ~/work/deche/deche/deche/core.py:336, in Cache.__call__.<locals>.wrapper(*args, **kwargs)
 334 logger.debug(f"Function {func} raised {e}")
 335 self.write_output(path=f"{path}/{key}{Extensions.exception}", output=e)
--> 336 raise e
 338 return output

File ~/work/deche/deche/deche/core.py:324, in Cache.__call__.<locals>.wrapper(*args, **kwargs)
 322 self.write_input(path=f"{path}/{key}", inputs=inputs)
 323 logger.debug(f"Calling {func}")
--> 324 output = func(*args, **kwargs)
 325 if self.result_validator is not None:
 326 logger.debug(f"Validating result with {self.result_validator}")

Cell In[7], line 7, in divide_by(n)
 5 @cache
 6 def divide_by(n):
----> 7 return 1/n
TypeError Traceback (most recent call last)
Cell In[1], line 3
 1 from deche import Cache
----> 3 cache = Cache(fs_protocol="memory")

ZeroDivisionError: division by zero
TypeError: Cache.__init__() missing 1 required positional argument: 'prefix'

Loading

0 comments on commit 09062b1

Please sign in to comment.