|
| 1 | +from collections.abc import Mapping |
| 2 | +from datetime import datetime |
| 3 | +from typing import Any, ParamSpec, TypeVar |
| 4 | + |
| 5 | +import celery |
| 6 | +import kombu |
| 7 | +from celery.app.task import Task |
| 8 | +from celery.canvas import Signature |
| 9 | + |
| 10 | +_P = ParamSpec("_P") |
| 11 | +_R = TypeVar("_R", covariant=True) |
| 12 | + |
| 13 | +class DjangoTask(Task[_P, _R]): |
| 14 | + def delay_on_commit( |
| 15 | + self, *args: _P.args, **kwargs: _P.kwargs |
| 16 | + ) -> celery.result.AsyncResult[_R]: ... |
| 17 | + def apply_async_on_commit( |
| 18 | + self, |
| 19 | + args: tuple[Any, ...] | None = ..., |
| 20 | + kwargs: dict[str, Any] | None = ..., |
| 21 | + task_id: str | None = ..., |
| 22 | + producer: kombu.Producer | None = ..., |
| 23 | + link: Signature[Any] | list[Signature[Any]] | None = ..., |
| 24 | + link_error: Signature[Any] | list[Signature[Any]] | None = ..., |
| 25 | + shadow: str | None = ..., |
| 26 | + *, |
| 27 | + # options |
| 28 | + countdown: float = ..., |
| 29 | + eta: datetime = ..., |
| 30 | + expires: float | datetime = ..., |
| 31 | + retry: bool = ..., |
| 32 | + retry_policy: Mapping[str, Any] = ..., |
| 33 | + queue: str | kombu.Queue = ..., |
| 34 | + exchange: str | kombu.Exchange = ..., |
| 35 | + routing_key: str = ..., |
| 36 | + priority: int = ..., |
| 37 | + serializer: str = ..., |
| 38 | + compression: str = ..., |
| 39 | + add_to_parent: bool = ..., |
| 40 | + publisher: kombu.Producer = ..., |
| 41 | + headers: dict[str, str] = ..., |
| 42 | + ignore_result: bool = ..., |
| 43 | + time_limit: int = ..., |
| 44 | + soft_time_limit: int = ..., |
| 45 | + ) -> celery.result.AsyncResult[_R]: ... |
0 commit comments