ractogateway.celery._models
Pydantic models for the Celery task-queue subsystem.
- class ractogateway.celery._models.TaskStatus(*values)[source]
-
Lifecycle state of a Celery task.
Maps directly to Celery’s native task states so you can compare them without importing Celery’s own constants.
- PENDING = 'pending'
- STARTED = 'started'
- SUCCESS = 'success'
- FAILURE = 'failure'
- RETRY = 'retry'
- REVOKED = 'revoked'
- class ractogateway.celery._models.TaskResult(**data)[source]
Bases:
BaseModelUnified result returned by
wait()andget_result().- Parameters:
task_id (str) – The Celery task UUID.
status (TaskStatus) – Current
TaskStatus.result (Any | None) –
Deserialised task output on success:
For
generate()— adictmatchingLLMResponse.model_dump()`.For
ingest_document()— alistofChunk.model_dump()` dicts.
error (str | None) – Exception message string on failure;
Noneon success.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- task_id: str
- status: TaskStatus
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property ok: bool
Truewhen the task succeeded and produced a result.
- class ractogateway.celery._models.RetryConfig(**data)[source]
Bases:
BaseModelExponential-backoff retry policy for
RactoCeleryWorkertasks.The backoff delay for attempt n (0-based) is:
delay = min(initial_delay_s * backoff_factor ** n, max_delay_s)
With the defaults this gives: 2 s → 4 s → 8 s (then stops at max_retries=3).
- Parameters:
max_retries (int) – Maximum number of retry attempts after the first failure.
0disables retries entirely.initial_delay_s (float) – Countdown (seconds) before the first retry.
backoff_factor (float) – Multiplier applied on each successive retry. Must be > 1.
max_delay_s (float) – Upper bound on the countdown (seconds). Prevents extremely long waits after many retries.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- max_retries: int
- initial_delay_s: float
- backoff_factor: float
- max_delay_s: float
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].