Skip to main content

WorkerRestart

Restarts a worker in different ways.

Attributes​

AttributeTypeDescription
MethodEnumAn enumeration defining the available strategies for restarting a worker, including pool-level restarts and graceful or forced Docker container restarts.

Methods​


restart_worker()​

@classmethod
def restart_worker(
worker: CeleryTestWorker,
method: WorkerRestart.Method,
assertion: bool = True
) - > None

Restart a Celery worker.

Parameters​

NameTypeDescription
workerCeleryTestWorkerThe specific Celery worker instance to be restarted.
methodWorkerRestart.MethodThe strategy used to restart the worker, such as a pool-level restart or a Docker container restart.
assertionbool = TrueWhen enabled, validates that the worker container has successfully returned to a 'running' state after the restart operation.

Returns​

TypeDescription
NoneNothing is returned; the method performs an in-place restart of the worker process or container.