File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1471,17 +1471,35 @@ async def start_unsafe(self):
14711471 @log_errors
14721472 async def close (
14731473 self ,
1474- timeout = 30 ,
1475- executor_wait = True ,
1476- nanny = True ,
1477- ):
1474+ timeout : float = 30 ,
1475+ executor_wait : bool = True ,
1476+ nanny : bool = True ,
1477+ ) -> str | None :
1478+ """Close the worker
1479+
1480+ Close asynchronous operations running on the worker, stop all executors and comms. If requested, this also closes the nanny.
1481+
1482+ Parameters
1483+ ----------
1484+ timeout : float, default 30
1485+ Timeout in seconds for shutting down individual instructions
1486+ executor_wait : bool, default True
1487+ If True, shut down executors synchronously, otherwise asynchronously
1488+ nanny : bool, default True
1489+ If True, close the nanny
1490+
1491+ Returns
1492+ -------
1493+ str | None
1494+ None if worker already in closing state or failed, "OK" otherwise
1495+ """
14781496 # FIXME: The worker should not be allowed to close the nanny. Ownership
14791497 # is the other way round. If an external caller wants to close
14801498 # nanny+worker, the nanny must be notified first. ==> Remove kwarg
14811499 # nanny, see also Scheduler.retire_workers
14821500 if self .status in (Status .closed , Status .closing , Status .failed ):
14831501 await self .finished ()
1484- return
1502+ return None
14851503
14861504 if self .status == Status .init :
14871505 # If the worker is still in startup/init and is started by a nanny,
You can’t perform that action at this time.
0 commit comments