Executable Jobs - celery.worker.job

Jobs Executable by the Worker Server.

class celery.worker.job.TaskWrapper(task_name, task_id, task_func, args, kwargs, on_ack=<function <lambda> at 0x21a7c70>, retries=0, **opts)

Class wrapping a task to be run.

Parameters:
task_name
Kind of task. Must be a name registered in the task registry.
task_id
UUID of the task.
task_func
The tasks callable object.
args
List of positional arguments to apply to the task.
kwargs
Mapping of keyword arguments to apply to the task.
message
The original message sent. Used for acknowledging the message.
execute(loglevel=None, logfile=None)

Execute the task in a celery.execute.ExecuteWrapper.

Parameters:
  • loglevel – The loglevel used by the task.
  • logfile – The logfile used by the task.
execute_using_pool(pool, loglevel=None, logfile=None)

Like execute(), but using the multiprocessing pool.

Parameters:
  • pool – A multiprocessing.Pool instance.
  • loglevel – The loglevel used by the task.
  • logfile – The logfile used by the task.

:returns multiprocessing.AsyncResult instance.

extend_with_default_kwargs(loglevel, logfile)

Extend the tasks keyword arguments with standard task arguments.

These are logfile, loglevel, task_id and task_name.

classmethod from_message(message, message_data, logger=None)

Create a TaskWrapper from a task message sent by celery.messaging.TaskPublisher.

Raises UnknownTaskError:
 if the message does not describe a task, the message is also rejected.
Returns:TaskWrapper instance.
on_failure(exc_info)
The handler used if the task raised an exception.
on_success(ret_value)
The handler used if the task was successfully processed ( without raising an exception).

Previous topic

Multiprocessing Worker - celery.worker

Next topic

Worker Controller Threads - celery.worker.controllers

This Page