Shutdown dask workers from client or scheduler

人盡茶涼 提交于 2019-12-05 06:03:58
mdurant

This seems like a feature that does not exist, but is nevertheless doable using the current code. You can use run_on_scheduler to interact with the methods of the scheduler itself.

workers = list(c.scheduler_info()['workers'])
c.run_on_scheduler(lambda dask_scheduler=None: 
    dask_scheduler.retire_workers(workers, close_workers=True))

where c is a Client, and we call retire_workers to gracefully ask each worker to exit.

There are probably other ways to achieve this. Note that the scheduler remains running in this case - it was not clear from the question if that is desired or not.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!