Add a restart mechanism to all workers in the multiplexer (#2622)

This commit is contained in:
Adam Hopkins
2022-12-11 11:33:42 +02:00
committed by GitHub
parent 8e720365c2
commit 92e7463721
2 changed files with 31 additions and 3 deletions

View File

@@ -21,9 +21,14 @@ class WorkerMultiplexer:
"state": ProcessState.ACKED.name,
}
def restart(self, name: str = ""):
def restart(self, name: str = "", all_workers: bool = False):
if name and all_workers:
raise ValueError(
"Ambiguous restart with both a named process and"
" all_workers=True"
)
if not name:
name = self.name
name = "__ALL_PROCESSES__:" if all_workers else self.name
self._monitor_publisher.send(name)
reload = restart # no cov