deseasion.backend.models.tasks module

class deseasion.backend.models.tasks.ProjectTaskModel(task_id, project=None, started_at=None, finished_at=None)

Bases: ModelMixin, Model

Save the details of a celery task.

Attributes:

task_id (str): The id of the Celery task. started_at (datetime): When the task was started. finished_at (datetime): When the task was finished. state:

The state of the task (‘PENDING’, ‘STARTED’, ‘FAILED’ or ‘REVOKED’)

error_message (str): A description of the error if the task failed. type:

The type of task (‘process_project_data’ or ‘update_stream’).

params: The arguments used for the task. project_id: The id of the project in which this task is executed.

error_message
finished_at
classmethod get_by_task_id(task_id)

Returns the first task in the database with the given task id

id
params
project
project_id
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

started_at
state
task_id
type
class deseasion.backend.models.tasks.ProjectTaskType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

process_project_data = 1
update_stream = 2