Browse Source

Exceptions, Threading

pull/170/head
Jure Šorn 1 year ago
parent
commit
f149d662ed
3 changed files with 13 additions and 13 deletions
  1. 8
      README.md
  2. 12
      index.html
  3. 6
      parse.js

8
README.md

@ -1456,13 +1456,13 @@ BaseException
+-- MemoryError # Out of memory. Could be too late to start deleting vars.
+-- NameError # Raised when nonexistent name (variable/func/class) is used.
| +-- UnboundLocalError # Raised when local name is used before it's being defined.
+-- OSError # Errors such as FileExistsError/PermissionError (see #Open).
+-- OSError # Errors such as FileExistsError/TimeoutError (see #Open).
| +-- ConnectionError # Errors such as BrokenPipeError/ConnectionAbortedError.
+-- RuntimeError # Raised by errors that don't fall into other categories.
| +-- NotImplementedEr… # Can be raised by abstract methods or by unfinished code.
| +-- RecursionError # Raised when the maximum recursion depth is exceeded.
+-- StopIteration # Raised by next() when run on an empty iterator.
+-- TypeError # Raised when an argument is of the wrong type.
+-- StopIteration # Raised when an empty iterator is passed to next().
+-- TypeError # When an argument of the wrong type is passed to function.
+-- ValueError # When argument has the right type but inappropriate value.
```
@ -2151,7 +2151,7 @@ with <lock>: # Enters the block by calling acq
<bool> = <Future>.cancel() # Cancels or returns False if running/finished.
<iter> = as_completed(<coll_of_Futures>) # Next() waits for next completed Future.
```
* **Map() and as\_completed() also accept 'timeout' arg. that causes TimeoutError when next() is called. Map() times from the original call, while as\_completed() from the call to next().**
* **Map() and as\_completed() also accept 'timeout' argument. It causes TimeoutError when next() is called if result isn't available in 'timeout' seconds from the original call.**
* **Exceptions that happen inside threads are raised when next() is called on map's iterator or when result() is called on a Future. Its exception() method returns exception or None.**
* **ProcessPoolExecutor provides true parallelism, but everything sent to/from workers must be [pickable](#pickle). Queues must be sent using executor's 'initargs' and 'initializer' parameters.**

12
index.html

@ -54,7 +54,7 @@
<body>
<header>
<aside>January 17, 2024</aside>
<aside>January 20, 2024</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header>
@ -1241,13 +1241,13 @@ error_msg = <span class="hljs-string">''</span>.join(traceback.format_exception(
├── MemoryError <span class="hljs-comment"># Out of memory. Could be too late to start deleting vars.</span>
├── NameError <span class="hljs-comment"># Raised when nonexistent name (variable/func/class) is used.</span>
│ └── UnboundLocalError <span class="hljs-comment"># Raised when local name is used before it's being defined.</span>
├── OSError <span class="hljs-comment"># Errors such as FileExistsError/PermissionError (see #Open).</span>
├── OSError <span class="hljs-comment"># Errors such as FileExistsError/TimeoutError (see #Open).</span>
│ └── ConnectionError <span class="hljs-comment"># Errors such as BrokenPipeError/ConnectionAbortedError.</span>
├── RuntimeError <span class="hljs-comment"># Raised by errors that don't fall into other categories.</span>
│ ├── NotImplementedEr… <span class="hljs-comment"># Can be raised by abstract methods or by unfinished code.</span>
│ └── RecursionError <span class="hljs-comment"># Raised when the maximum recursion depth is exceeded.</span>
├── StopIteration <span class="hljs-comment"># Raised by next() when run on an empty iterator.</span>
├── TypeError <span class="hljs-comment"># Raised when an argument is of the wrong type.</span>
├── StopIteration <span class="hljs-comment"># Raised when an empty iterator is passed to next().</span>
├── TypeError <span class="hljs-comment"># When an argument of the wrong type is passed to function.</span>
└── ValueError <span class="hljs-comment"># When argument has the right type but inappropriate value.</span>
</code></pre></div>
@ -1774,7 +1774,7 @@ CompletedProcess(args=[<span class="hljs-string">'bc'</span>, <span class="hljs-
&lt;iter&gt; = as_completed(&lt;coll_of_Futures&gt;) <span class="hljs-comment"># Next() waits for next completed Future.</span>
</code></pre>
<ul>
<li><strong>Map() and as_completed() also accept 'timeout' arg. that causes TimeoutError when next() is called. Map() times from the original call, while as_completed() from the call to next().</strong></li>
<li><strong>Map() and as_completed() also accept 'timeout' argument. It causes TimeoutError when next() is called if result isn't available in 'timeout' seconds from the original call.</strong></li>
<li><strong>Exceptions that happen inside threads are raised when next() is called on map's iterator or when result() is called on a Future. Its exception() method returns exception or None.</strong></li>
<li><strong>ProcessPoolExecutor provides true parallelism, but everything sent to/from workers must be <a href="#pickle">pickable</a>. Queues must be sent using executor's 'initargs' and 'initializer' parameters.</strong></li>
</ul>
@ -2932,7 +2932,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the activ
<footer>
<aside>January 17, 2024</aside>
<aside>January 20, 2024</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer>

6
parse.js

@ -439,13 +439,13 @@ const DIAGRAM_7_B =
" ├── MemoryError <span class='hljs-comment'># Out of memory. Could be too late to start deleting vars.</span>\n" +
" ├── NameError <span class='hljs-comment'># Raised when nonexistent name (variable/func/class) is used.</span>\n" +
" │ └── UnboundLocalError <span class='hljs-comment'># Raised when local name is used before it's being defined.</span>\n" +
" ├── OSError <span class='hljs-comment'># Errors such as FileExistsError/PermissionError (see #Open).</span>\n" +
" ├── OSError <span class='hljs-comment'># Errors such as FileExistsError/TimeoutError (see #Open).</span>\n" +
" │ └── ConnectionError <span class='hljs-comment'># Errors such as BrokenPipeError/ConnectionAbortedError.</span>\n" +
" ├── RuntimeError <span class='hljs-comment'># Raised by errors that don't fall into other categories.</span>\n" +
" │ ├── NotImplementedEr… <span class='hljs-comment'># Can be raised by abstract methods or by unfinished code.</span>\n" +
" │ └── RecursionError <span class='hljs-comment'># Raised when the maximum recursion depth is exceeded.</span>\n" +
" ├── StopIteration <span class='hljs-comment'># Raised by next() when run on an empty iterator.</span>\n" +
" ├── TypeError <span class='hljs-comment'># Raised when an argument is of the wrong type.</span>\n" +
" ├── StopIteration <span class='hljs-comment'># Raised when an empty iterator is passed to next().</span>\n" +
" ├── TypeError <span class='hljs-comment'># When an argument of the wrong type is passed to function.</span>\n" +
" └── ValueError <span class='hljs-comment'># When argument has the right type but inappropriate value.</span>\n";
const DIAGRAM_8_A =

Loading…
Cancel
Save