qhana_plugin_runner.db.models.tasks module
- class qhana_plugin_runner.db.models.tasks.ProcessingTask(task_name, started_at=datetime.datetime(2026, 6, 3, 8, 11, 23, 779002), finished_at=None, parameters='', data=<factory>, multi_step=False, steps=<factory>, current_step=-1, progress_value=None, progress_start=0, progress_target=100, progress_unit='%', task_status=None, task_log='', outputs=<factory>, links=<factory>, subscriptions=<factory>)
Bases:
objectDataclass for persisting (logical) task information.
- id
automatically generated database id. Use the id to fetch this information from the database.
- Type:
int, optional
- started_at
the moment the task was scheduled. (default
utcnow())- Type:
datetime, optional
- finished_at
the moment the task finished successfully or with an error.
- Type:
Optional[datetime], optional
- parameters
the parameters for the task. Task parameters should already be prepared and error checked before starting the task.
- Type:
- data
mutable JSON-like store for additional lightweight task data. Default value is empty dict.
- Type:
JSON_LIKE
- steps
ordered list of steps of type
Step. Indexnumberautomatically increases when new elements are appended. Note: only useadd_next_step()to add a new step. Steps must not be deleted.- Type:
OrderingList[Step]
- task_status
the status string of the plugin execution, can only be
PENDING,SUCCESS, orERROR.- Type:
Optional[str], optional
- task_log
the task log, task metadata or the error of the finished task. All data results should be file outputs of the task!
- Type:
- add_next_step(href: str, ui_href: str, step_id: str, commit: bool = False)
Adds new step for multi-step plugin.
- Parameters:
- Raises:
AssertionError – raised in case the previous step was not cleared before this method is called.
- add_task_log_entry(task_log: str, commit: bool = False)
Appends
task_logseparated by a new line.- Parameters:
task_log (str) – new entry to be added
- clear_previous_step(commit: bool = False)
Set
"cleared"of previous step totrueif available. Note: call before calling add_next_step.
- data: Mapped[Dict[str, Dict[str, Any] | list | str | float | int | bool | None] | List[Dict[str, Any] | list | str | float | int | bool | None] | str | float | int | bool | None]
- classmethod get_by_id(id_: int) ProcessingTask | None
Get the object instance by the object id from the database. (None if not found)
- property is_finished: bool
Return true if the task has finished either successfully or with an error.
- save(commit: bool = False)
Add this object to the current session and optionally commit the session to persist all objects in the session.
- property status: str
Return the finished status of the task.
If the task is finished but no task_status was set returns
"UNKNOWN".If the task is not finished returns
"PENDING".- Returns:
self.task_status|"UNKNOWN"|"PENDING"- Return type:
- subscriptions: Mapped[List[TaskUpdateSubscription]]
- class qhana_plugin_runner.db.models.tasks.Step(id, step_id, href, ui_href, cleared=False)
Bases:
objectStep for multi-step plugins
- id
ID of corresponding
ProcessingTaskentry. Use the id to fetch this information from the database.- Type:
int, optional
- class qhana_plugin_runner.db.models.tasks.TaskFile(task: ProcessingTask, security_tag: str, storage_provider: str, file_name: str, file_storage_data: str, file_type: str | None, mimetype: str | None = None, created_at: datetime = datetime.datetime(2026, 6, 3, 8, 11, 23, 787451))
Bases:
object- classmethod get_by_id(id_: int) TaskFile | None
Get the object instance by the object id from the database. (None if not found)
- classmethod get_task_result_files(task: int | ProcessingTask) Sequence[TaskFile]
Get a sequence of task result files (e.g. all files with a file-type that is not “temp-file”).
- save(commit: bool = False)
Add this object to the current session and optionally commit the session to persist all objects in the session.
- task: Mapped[ProcessingTask]
- class qhana_plugin_runner.db.models.tasks.TaskLink(task, type, href)
Bases:
objectLinks that get exposed in the task result.
Use these links to expose additional endpoints relevant for plugin-to-plugin interaction that depends on the current task context.
- task: Mapped[ProcessingTask]
- class qhana_plugin_runner.db.models.tasks.TaskUpdateSubscription(task, webhook_href, task_href, event_type=None)
Bases:
objectTable for webhook subscriptions to task updates.
- classmethod get_by_task_and_event(task: int | ProcessingTask, event: str | None = None) List[WebhookRef]
Get all webhooks for a task matching the given event type. (‘None’ matches all types.)
- classmethod get_by_task_and_subscriber(task: int | ProcessingTask, webhook_href: str, event: str | None = Ellipsis) List[TaskUpdateSubscription]
Get all webhooks for a task matching the given event type. (‘None’ matches all types.)
- save(commit: bool = False)
Add this object to the current session and optionally commit the session to persist all objects in the session.
- task: Mapped[ProcessingTask]