DjangoTask
Extend the base :class:~celery.app.task.Task for Django. Provide a nicer API to trigger tasks at the end of the DB transaction.
Methods
delay_on_commit()
@classmethod
def delay_on_commit(
*args: Any,
**kwargs: Any
) - > null
Call :meth:~celery.app.task.Task.delay with Django's on_commit().
Parameters
| Name | Type | Description |
|---|---|---|
| *args | Any | Positional arguments to be passed to the task function when it is executed. |
| **kwargs | Any | Keyword arguments to be passed to the task function when it is executed. |
Returns
| Type | Description |
|---|---|
null | Nothing is returned; the task is scheduled for execution after the current database transaction commits. |
apply_async_on_commit()
@classmethod
def apply_async_on_commit(
*args: Any,
**kwargs: Any
) - > null
Call :meth:~celery.app.task.Task.apply_async with Django's on_commit().
Parameters
| Name | Type | Description |
|---|---|---|
| *args | Any | Positional arguments to be passed to the task's apply_async method. |
| **kwargs | Any | Keyword arguments representing execution options such as countdown, eta, or queue names. |
Returns
| Type | Description |
|---|---|
null | Nothing is returned; the task execution is deferred until the database transaction is successfully committed. |