Skip to content

Commit

Permalink
Remove skips from doctests (5 of 6) (dask#7864)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzhengnan committed Jul 28, 2021
1 parent c8718d5 commit 724907f
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions dask/diagnostics/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class Profiler(Callback):
22
>>> prof.results # doctest: +SKIP
[('y', (add, 'x', 10), 1435352238.48039, 1435352238.480655, 140285575100160),
('z', (mul, 'y', 2), 1435352238.480657, 1435352238.480803, 140285566707456)]
[TaskData(key='y', task=(add, 'x', 10), start_time=..., end_time=..., worker_id=...),
TaskData(key='z', task=(mul, 'y', 2), start_time=..., end_time=..., worker_id=...)]
These results can be visualized in a bokeh plot using the ``visualize``
method. Note that this requires bokeh to be installed.
Expand All @@ -45,7 +45,7 @@ class Profiler(Callback):
You can activate the profiler globally
>>> prof.register() # doctest: +SKIP
>>> prof.register()
If you use the profiler globally you will need to clear out old results
manually.
Expand Down Expand Up @@ -119,7 +119,7 @@ class ResourceProfiler(Callback):
>>> from operator import add, mul
>>> from dask.threaded import get
>>> dsk = {'x': 1, 'y': (add, 'x', 10), 'z': (mul, 'y', 2)}
>>> with ResourceProfiler() as prof: # doctest: +SKIP
>>> with ResourceProfiler() as prof:
... get(dsk, 'z')
22
Expand All @@ -130,12 +130,12 @@ class ResourceProfiler(Callback):
You can activate the profiler globally
>>> prof.register() # doctest: +SKIP
>>> prof.register()
If you use the profiler globally you will need to clear out old results
manually.
>>> prof.clear() # doctest: +SKIP
>>> prof.clear()
Note that when used as a context manager data will be collected throughout
the duration of the enclosed block. In contrast, when registered globally
Expand Down Expand Up @@ -296,17 +296,18 @@ class CacheProfiler(Callback):
22
>>> prof.results # doctest: +SKIP
[CacheData('y', (add, 'x', 10), 1, 1435352238.48039, 1435352238.480655),
CacheData('z', (mul, 'y', 2), 1, 1435352238.480657, 1435352238.480803)]
[CacheData(key='y', task=(add, 'x', 10), metric=1, cache_time=..., free_time=...),
CacheData(key='z', task=(mul, 'y', 2), metric=1, cache_time=..., free_time=...)]
The default is to count each task (``metric`` is 1 for all tasks). Other
functions may used as a metric instead through the ``metric`` keyword. For
example, the ``nbytes`` function found in ``cachey`` can be used to measure
the number of bytes in the cache.
>>> from cachey import nbytes # doctest: +SKIP
>>> with CacheProfiler(metric=nbytes) as prof: # doctest: +SKIP
>>> from cachey import nbytes
>>> with CacheProfiler(metric=nbytes) as prof:
... get(dsk, 'z')
22
The profiling results can be visualized in a bokeh plot using the
``visualize`` method. Note that this requires bokeh to be installed.
Expand All @@ -315,7 +316,7 @@ class CacheProfiler(Callback):
You can activate the profiler globally
>>> prof.register() # doctest: +SKIP
>>> prof.register()
If you use the profiler globally you will need to clear out old results
manually.
Expand Down

0 comments on commit 724907f

Please sign in to comment.