Spec-Zone.ru › Celery

celery.contrib.testing.worker

Embedded workers for integration tests.

classcelery.contrib.testing.worker.TestWorkController(*args:Any, **kwargs:Any)

Worker that can synchronize on being fully started.

classQueueHandler(queue)
handleError(record)

Handle errors which occur during an emit() call.

This method should be called from handlers when an exception is encountered during an emit() call. If raiseExceptions is false, exceptions get silently ignored. This is what is mostly wanted for a logging system - most users will not care about errors in the logging system, they are more interested in application errors. You could, however, replace this with a custom handler if you wish. The record which was being processed is passed in to this method.

prepare(record)

Prepares a record for queuing. The object returned by this method is enqueued.

The base implementation formats the record to merge the message and arguments, and removes unpickleable items from the record in-place.

You might want to override this method if you want to convert the record to a dict or JSON string, or send a modified copy of the record while leaving the original intact.

ensure_started() → None

Wait for worker to be fully up and running.

Warning

Worker must be started within a thread for this to work, or it will block forever.

logger_queue=None
on_consumer_ready(consumer:Consumer) → None

Callback called when the Consumer blueprint is fully started.

start()
celery.contrib.testing.worker.setup_app_for_worker(app:Celery, loglevel:str|int, logfile:str) → None

Setup the app to be used for starting an embedded worker.

celery.contrib.testing.worker.start_worker(app:Celery, concurrency:int=1, pool:str='solo', loglevel:str|int='error', logfile:str=None, perform_ping_check:bool=True, ping_task_timeout:float=10.0, shutdown_timeout:float=10.0, **kwargs:Any) → Iterable

Start embedded worker.

Yields:

celery.app.worker.Worker – worker instance.

Copyright © 2017-2026 Asif Saif Uddin, core team & contributors. All rights reserved.
Celery is licensed under The BSD License (3 Clause, also known as the new BSD license). The license is an OSI approved Open Source license and is GPL-compatible.
https://docs.celeryq.dev/en/stable/reference/celery.contrib.testing.worker.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API