You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Restart given worker(s) using client [help wanted] #1823
Current client.restart() restarts all workers and entire cluster. Is there a way to restart or perform stop, start, restart operation on single / list of workers using the client apis.
This will allow cleanup of specific workers only without affecting others where additional tasks may be running.
Is it possible to restart the scheduler? One thing I noticed is that if you have published datasets and then call client.restart, the datasets are still published in the scheduler. If another client then asks for the result from one of those datasets, the scheduler does not reissue the work to a worker. It seems like client.restart should also restart the scheduler or at least unpublish all datasets.
Add retire_workers looks like helps shutting down workers without removing them completely. But is there a way to start these workers again using an api.
I would like to restart the worker after every task is run as there seems to be a memory leak with dask and my tasks (which does not occur when the task is run locally). any ideas - or should I make a new PR.
I solved it with the below. This assumes your dask-worker(s) are overseen by nanny managers. This will throw a CommClosedError as the scheduler can no longer communicate with the worker but otherwise it should reboot, however hacky.
import os
my_worker = 'name-or-ip-address-to-worker'
client.run(lamda: os._exit(0), workers=[my_worker])
Reacted by Willem, Franck Charras, Luke Funk and Moon
I'm investigating this as a potential solution to #391 (comment), in which we occasionally see unresponsive workers during network-heavy aggregation operations.
Looking through the existing restart code, it appears that a something akin to "retire workers" could be implemented that first
makes an attempt to replicate data from the worker that's about to be restarted, via:
I have looked at retire_workers in the past and I would agree that it makes sense in the restart-particular-worker scenario. However, if the worker is unresponsive, what is the hope to be able to copy its data?
Tried the retire_workers api using cl.retire_workers and with close_workers=False nothing happens and if default setting the worker completely shutsdown but doesnt come up again.
Any other way to restart a particular worker, may be via nanny or some other method.
Activity
[-]Shutdown given worker(s) using client[/-][+]Shutdown given worker(s) using client [help wanted][/+][-]Shutdown given worker(s) using client [help wanted][/-][+]Restart given worker(s) using client [help wanted][/+]mrocklin commentedon Mar 9, 2018
No, there is not currently an easy way to do this.
sheridp commentedon Mar 15, 2018
Is it possible to restart the scheduler? One thing I noticed is that if you have published datasets and then call client.restart, the datasets are still published in the scheduler. If another client then asks for the result from one of those datasets, the scheduler does not reissue the work to a worker. It seems like client.restart should also restart the scheduler or at least unpublish all datasets.
martindurant commentedon Mar 15, 2018
Unpublishing all datasets when performing a restart would be easy to implement, e.g., by adding a
restart()method toPublishExtension.mrocklin commentedon Mar 15, 2018
I recommend raising the published datasets topic as a separate issue.
ameetshah1983 commentedon Apr 4, 2018
Add retire_workers looks like helps shutting down workers without removing them completely. But is there a way to start these workers again using an api.
mrocklin commentedon Apr 4, 2018
You're right. That PR doesn't solve your issue.
VMois commentedon Nov 30, 2018
Any ideas or suggestions about this issue. I want to use worker restart to refresh local packages cache. Is it makes sense to make PR for this.
wkerzendorf commentedon May 18, 2019
I would like to restart the worker after every task is run as there seems to be a memory leak with dask and my tasks (which does not occur when the task is run locally). any ideas - or should I make a new PR.
nmatare commentedon Jul 7, 2019
I came across this requirement as well:
I solved it with the below. This assumes your dask-worker(s) are overseen by nanny managers. This will throw a
CommClosedErroras the scheduler can no longer communicate with the worker but otherwise it should reboot, however hacky.asford commentedon Jan 31, 2021
I'm investigating this as a potential solution to #391 (comment), in which we occasionally see unresponsive workers during network-heavy aggregation operations.
Looking through the existing restart code, it appears that a something akin to "retire workers" could be implemented that first
makes an attempt to replicate data from the worker that's about to be restarted, via:
distributed/distributed/scheduler.py
Lines 5446 to 5462 in 1297b18
Then issues a command to the nanny (if present) to restart the worker process:
https://github.com/dask/distributed/blob/1297b18ff09276f6ad1553d40ab3ce77acf0fc0e/distributed/scheduler.py#L4874-L4881#4345
@mrocklin, Would this make sense as an additional scheduler api?
martindurant commentedon Feb 1, 2021
I have looked at retire_workers in the past and I would agree that it makes sense in the restart-particular-worker scenario. However, if the worker is unresponsive, what is the hope to be able to copy its data?
ameetshah1983 commentedon Oct 13, 2021
Tried the retire_workers api using cl.retire_workers and with close_workers=False nothing happens and if default setting the worker completely shutsdown but doesnt come up again.
Any other way to restart a particular worker, may be via nanny or some other method.