Skip to main content

default

Default task execution strategy.

def default(
task: celery.app.task.Task,
app: celery.Celery,
consumer: celery.worker.consumer.Consumer,
info: callable = logger.info,
error: callable = logger.error,
task_reserved: callable = task_reserved,
to_system_tz: callable = timezone.to_system,
bytes: type = bytes,
proto1_to_proto2: callable = proto1_to_proto2
) - > function

Default task execution strategy. Note: Strategies are here as an optimization, so sadly it's not very easy to override.

Parameters

NameTypeDescription
taskcelery.app.task.TaskThe task instance for which this execution strategy is being generated.
appcelery.CeleryThe Celery application instance providing configuration and timezone settings.
consumercelery.worker.consumer.ConsumerThe worker consumer instance responsible for managing the connection, timer, and task buckets.
infocallable = logger.infoLogging function used to record task receipt and metadata.
errorcallable = logger.errorLogging function used to record errors during ETA conversion or processing.
task_reservedcallable = task_reservedCallback triggered when a task is officially reserved by the worker.
to_system_tzcallable = timezone.to_systemUtility function to convert UTC datetimes to the local system timezone.
bytestype = bytesThe bytes type used for message body handling.
proto1_to_proto2callable = proto1_to_proto2Converter function to translate legacy Celery protocol 1 messages to protocol 2.

Returns

TypeDescription
functionA closure (task_message_handler) that processes incoming AMQP messages for the specific task, handling decoding, ETA scheduling, and rate limiting.