WorkerRestart
Restarts a worker in different ways.
Attributes
| Attribute | Type | Description |
|---|---|---|
| Method | Enum | An 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
| Name | Type | Description |
|---|---|---|
| worker | CeleryTestWorker | The specific Celery worker instance to be restarted. |
| method | WorkerRestart.Method | The strategy used to restart the worker, such as a pool-level restart or a Docker container restart. |
| assertion | bool = True | When enabled, validates that the worker container has successfully returned to a 'running' state after the restart operation. |
Returns
| Type | Description |
|---|---|
None | Nothing is returned; the method performs an in-place restart of the worker process or container. |