将dask任务流导出到svg



我正在公司集群上使用dask_syarn进行数据分析。

Dask正在指定链接上显示仪表板。完成所有任务后,我想将dask仪表板保存为svg文件。

工具栏中没有用于执行此操作的工具。

如何将结果保存为svg?

虽然似乎无法直接用get_task_stream保存,但您可以使用存储在任务流对象中的bokeh图形作为ts.figure:

from dask.distributed import Client, get_task_stream
import time
client = Client()
with get_task_stream(client, plot='save', filename='task_stream.html') as ts:
futs = client.map(lambda x: time.sleep(x**2), range(5))
results = client.gather(futs)
from bokeh.io import export_png
# note to use this you will need to install additional modules
# conda install -c conda-forge firefox geckodriver
# or see https://docs.bokeh.org/en/latest/docs/user_guide/export.html
export_png(ts.figure, filename="plot.png")

还有其他导出bokeh数据的方法,请参阅文档。

最新更新