Executable Jobs - celery.worker.job
Jobs Executable by the Worker Server.
-
exception celery.worker.job.AlreadyExecutedError
- Tasks can only be executed once, as they might change
world-wide state.
-
class celery.worker.job.TaskWrapper(task_name, task_id, task_func, args, kwargs, on_ack=<function <lambda> at 0x10301f6e0>, retries=0, **opts)
Class wrapping a task to be passed around and finally
executed inside of the worker.
-
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.
Set if the task has been executed. A task should only be executed
once.
-
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.
Currently these are logfile, loglevel, task_id,
task_name and task_retries.
See celery.task.base.Task.run() for more information.
-
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).