app.celery.ContextTask
- class app.celery.ContextTask
Bases:
celery.app.task.Task
Attributes
Request class used, or the qualified name of one.
Execution strategy used, or the qualified name of one.
Deprecated attribute
abstract
here for compatibility.When enabled messages for this task will be acknowledged after the task has been executed, and not just before (the default behavior).
When enabled messages for this task will be acknowledged even if it fails or times out.
Default time in seconds before a retry of the task should be executed.
Default task expiry time.
If enabled the worker won't store task state and return values for this task. Defaults to the :setting:`task_ignore_result` setting.
Maximum number of retries before giving up.
Name of the task.
Default task priority.
None
(no rate limit), '100/s' (hundred tasks a second), '100/m' (hundred tasks a minute),`'100/h'` (hundred tasks an hour)Even if
acks_late
is enabled, the worker will acknowledge tasks when the worker process executing them abruptly exits or is signaled (e.g., :sig:`KILL`/:sig:`INT`, etc).Get current request object.
Task request stack, the current request will be the topmost.
Max length of result representation used in logs and events.
If enabled the worker will send monitoring events related to this task (but only if the worker is configured to send task related events).
The name of a serializer that are registered with
kombu.serialization.registry
.Soft time limit. Defaults to the :setting:`task_soft_time_limit` setting.
When enabled errors will be stored even if the task is otherwise configured to ignore results.
Tuple of expected exceptions.
Hard time limit. Defaults to the :setting:`task_time_limit` setting.
If enabled the task will report its status as 'started' when the task is executed by a worker.
If enabled the request will keep track of subtasks started by this task, and this information will be sent with the result (
result.children
).Enable argument checking.
Methods
ContextTask.AsyncResult
(task_id, **kwargs)Get AsyncResult instance for the specified task.
ContextTask.add_around
(attr, around)ContextTask.add_to_chord
(sig[, lazy])Add signature to the chord the current task is a member of.
ContextTask.add_trail
(result)ContextTask.after_return
(status, retval, ...)Handler called after the task returns.
ContextTask.apply
([args, kwargs, link, ...])Execute this task locally, by blocking until the task returns.
ContextTask.apply_async
([args, kwargs, ...])Apply tasks asynchronously by sending a message.
ContextTask.before_start
(task_id, args, kwargs)Handler called before the task starts.
ContextTask.bind
(app)ContextTask.chunks
(it, n)Create a
chunks
task for this task.ContextTask.delay
(*args, **kwargs)Star argument version of
apply_async()
.ContextTask.map
(it)Create a
xmap
task fromit
.ContextTask.on_bound
(app)Called when the task is bound to an app.
ContextTask.on_failure
(exc, task_id, args, ...)Error handler.
ContextTask.on_retry
(exc, task_id, args, ...)Retry handler.
ContextTask.on_success
(retval, task_id, ...)Success handler.
ContextTask.push_request
(*args, **kwargs)ContextTask.replace
(sig)Replace this task, with a new task inheriting the task id.
ContextTask.retry
([args, kwargs, exc, ...])Retry the task, adding it to the back of the queue.
ContextTask.run
(*args, **kwargs)The body of the task executed by workers.
ContextTask.s
(*args, **kwargs)Create signature.
ContextTask.send_event
(type_[, retry, ...])Send monitoring event message.
ContextTask.shadow_name
(args, kwargs, options)Override for custom task name in worker logs/monitoring.
ContextTask.si
(*args, **kwargs)Create immutable signature.
ContextTask.signature
([args])Create signature.
Create a
xstarmap
task fromit
.ContextTask.start_strategy
(app, consumer, ...)ContextTask.subtask
([args])Create signature.
ContextTask.subtask_from_request
([request, ...])ContextTask.update_state
([task_id, state, meta])Update task state.