... | ... |
@@ -338,6 +338,8 @@ class BlockingRunner(BaseRunner): |
338 | 338 |
self._cleanup() |
339 | 339 |
|
340 | 340 |
def elapsed_time(self): |
341 |
+ """Return the total time elapsed since the runner |
|
342 |
+ was started.""" |
|
341 | 343 |
if self.end_time is None: |
342 | 344 |
# This shouldn't happen if the BlockingRunner |
343 | 345 |
# correctly finished. |
... | ... |
@@ -532,6 +534,8 @@ class AsyncRunner(BaseRunner): |
532 | 534 |
self._cleanup() |
533 | 535 |
|
534 | 536 |
def elapsed_time(self): |
537 |
+ """Return the total time elapsed since the runner |
|
538 |
+ was started.""" |
|
535 | 539 |
if self.task.done(): |
536 | 540 |
end_time = self.end_time |
537 | 541 |
if end_time is None: |
... | ... |
@@ -298,6 +298,15 @@ raise the exception with the stack trace: |
298 | 298 |
|
299 | 299 |
runner.task.result() |
300 | 300 |
|
301 |
+ |
|
302 |
+You can also check ``runner.tracebacks`` which is a mapping from |
|
303 |
+point → traceback. |
|
304 |
+ |
|
305 |
+.. jupyter-execute:: |
|
306 |
+ |
|
307 |
+ for point, tb in runner.tracebacks.items(): |
|
308 |
+ print(f'point: {point}:\n {tb}') |
|
309 |
+ |
|
301 | 310 |
Logging runners |
302 | 311 |
~~~~~~~~~~~~~~~ |
303 | 312 |
|
... | ... |
@@ -337,10 +346,16 @@ set of operations on another runner: |
337 | 346 |
|
338 | 347 |
learner.plot().Scatter.I.opts(style=dict(size=6)) * reconstructed_learner.plot() |
339 | 348 |
|
340 |
-Timing functions |
|
341 |
-~~~~~~~~~~~~~~~~ |
|
349 |
+Adding coroutines |
|
350 |
+----------------- |
|
351 |
+ |
|
352 |
+In the following example we'll add a `~asyncio.Task` that times the runner. |
|
353 |
+This is *only* for demonstration purposes because one can simply |
|
354 |
+check ``runner.elapsed_time()`` or use the ``runner.live_info()`` |
|
355 |
+widget to see the time since the runner has started. |
|
342 | 356 |
|
343 |
-To time the runner you **cannot** simply use |
|
357 |
+So let's get on with the example. To time the runner |
|
358 |
+you **cannot** simply use |
|
344 | 359 |
|
345 | 360 |
.. code:: python |
346 | 361 |
|