用法:
dask.diagnostics.Profiler()
在任務級別執行 dask 的分析器。
- 記錄每個任務的以下信息:
Key
Task
自紀元以來的開始時間(以秒為單位)
自紀元以來的完成時間(以秒為單位)
工人編號
例子:
>>> from operator import add, mul >>> from dask.threaded import get >>> from dask.diagnostics import Profiler >>> dsk = {'x': 1, 'y': (add, 'x', 10), 'z': (mul, 'y', 2)} >>> with Profiler() as prof: ... get(dsk, 'z') 22
>>> prof.results [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=...)]
這些結果可以使用
visualize
方法在散景圖中可視化。請注意,這需要安裝散景。>>> prof.visualize()
您可以全局激活分析器
>>> prof.register()
如果您在全局範圍內使用分析器,則需要手動清除舊結果。
>>> prof.clear() >>> prof.unregister()
相關用法
- Python dask.diagnostics.ProgressBar用法及代碼示例
- Python dask.diagnostics.CacheProfiler用法及代碼示例
- Python dask.diagnostics.Callback用法及代碼示例
- Python dask.diagnostics.ResourceProfiler用法及代碼示例
- Python dask.distributed.SSHCluster用法及代碼示例
- Python dask.distributed.get_task_stream用法及代碼示例
- Python dask.distributed.progress用法及代碼示例
- Python dask.dataframe.Series.apply用法及代碼示例
- Python dask.dataframe.to_records用法及代碼示例
- Python dask.dataframe.DataFrame.applymap用法及代碼示例
- Python dask.dataframe.Series.clip用法及代碼示例
- Python dask.dataframe.Series.prod用法及代碼示例
- Python dask.dataframe.Series.fillna用法及代碼示例
- Python dask.dataframe.DataFrame.sub用法及代碼示例
- Python dask.dataframe.compute用法及代碼示例
- Python dask.dataframe.DataFrame.mod用法及代碼示例
- Python dask.dataframe.Series.to_frame用法及代碼示例
- Python dask.dataframe.read_table用法及代碼示例
- Python dask.dataframe.read_hdf用法及代碼示例
- Python dask.dataframe.Series.sum用法及代碼示例
注:本文由純淨天空篩選整理自dask.org大神的英文原創作品 dask.diagnostics.Profiler。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。