models
Note that this module is imported from fractal_server/migrations/env.py
,
thus we should always export all relevant database models from here or they
will not be picked up by alembic.
ApplyWorkflow
¶
Bases: _ApplyWorkflowBaseV1
, SQLModel
Represent a workflow run
This table is responsible for storing the state of a workflow execution in the database.
Attributes:
Name | Type | Description |
---|---|---|
id |
Optional[int]
|
Primary key. |
project_id |
Optional[int]
|
ID of the project the workflow belongs to, or |
input_dataset_id |
Optional[int]
|
ID of the input dataset, or |
output_dataset_id |
Optional[int]
|
ID of the output dataset, or |
workflow_id |
Optional[int]
|
ID of the workflow being applied, or |
status |
str
|
Job status |
workflow_dump |
dict[str, Any]
|
Copy of the submitted workflow at submission. |
input_dataset_dump |
dict[str, Any]
|
Copy of the input_dataset at submission. |
output_dataset_dump |
dict[str, Any]
|
Copy of the output_dataset at submission. |
start_timestamp |
datetime
|
Timestamp of when the run began. |
end_timestamp |
Optional[datetime]
|
Timestamp of when the run ended or failed. |
status |
str
|
Status of the run. |
log |
Optional[str]
|
Forward of the workflow logs. |
user_email |
str
|
Email address of the user who submitted the job. |
slurm_account |
Optional[str]
|
Account to be used when submitting the job to SLURM (see "account"
option in |
first_task_index |
int
|
|
last_task_index |
int
|
|
Source code in fractal_server/app/models/v1/job.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
Dataset
¶
Bases: _DatasetBaseV1
, SQLModel
Represent a dataset
Attributes:
Name | Type | Description |
---|---|---|
id |
Optional[int]
|
Primary key |
project_id |
int
|
ID of the project the workflow belongs to. |
meta |
dict[str, Any]
|
Metadata of the Dataset |
history |
list[dict[str, Any]]
|
History of the Dataset |
resource_list |
list[Resource]
|
(Mapper attribute) |
Source code in fractal_server/app/models/v1/dataset.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
JobStatusTypeV1
¶
Bases: str
, Enum
Define the available job statuses
Attributes:
Name | Type | Description |
---|---|---|
SUBMITTED |
The job was created. This does not guarantee that it was also submitted to an executor (e.g. other errors could have prevented this), nor that it is actually running (e.g. SLURM jobs could be still in the queue). |
|
DONE |
The job successfully reached its end. |
|
FAILED |
The workflow terminated with an error. |
Source code in fractal_server/app/schemas/v1/applyworkflow.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
OAuthAccount
¶
Bases: SQLModel
ORM model for OAuth accounts (oauthaccount
database table).
This class is based on fastapi_users_db_sqlmodel::SQLModelBaseOAuthAccount. Original Copyright: 2021 François Voron, released under MIT licence.
Attributes:
Name | Type | Description |
---|---|---|
id |
Optional[int]
|
|
user_id |
int
|
|
user |
Optional[UserOAuth]
|
|
oauth_name |
str
|
|
access_token |
str
|
|
expires_at |
Optional[int]
|
|
refresh_token |
Optional[str]
|
|
account_id |
str
|
|
account_email |
str
|
|
Source code in fractal_server/app/models/security.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
State
¶
Bases: SQLModel
Store arbitrary data in the database
This table is just a state interchange that allows the system to store arbitrary data for later retrieval. This is particuarly important for long background tasks, in which it is not possible to return a meaningful response to the client within a single request lifespan.
Attributes:
Name | Type | Description |
---|---|---|
id |
Optional[int]
|
Primary key |
data |
dict[str, Any]
|
Content of the |
timestamp |
datetime
|
Timestap of the |
Source code in fractal_server/app/models/v1/state.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
Task
¶
Bases: _TaskBaseV1
, SQLModel
Task model
Attributes:
Name | Type | Description |
---|---|---|
id |
Optional[int]
|
Primary key |
command |
str
|
Executable command |
input_type |
str
|
Expected type of input |
output_type |
str
|
Expected type of output |
meta |
Optional[dict[str, Any]]
|
Additional metadata related to execution (e.g. computational resources) |
source |
str
|
inherited from |
name |
str
|
inherited from |
args_schema |
Optional[dict[str, Any]]
|
JSON schema of task arguments |
args_schema_version |
Optional[str]
|
label pointing at how the JSON schema of task arguments was generated |
Source code in fractal_server/app/models/v1/task.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
default_args_from_args_schema: dict[str, Any]
property
¶
Extract default arguments from args_schema
TaskGroupV2
¶
Bases: SQLModel
Source code in fractal_server/app/models/v2/task_group.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
UserGroup
¶
Bases: SQLModel
ORM model for the usergroup
database table.
Attributes:
Name | Type | Description |
---|---|---|
id |
Optional[int]
|
ID of the group |
name |
str
|
Name of the group |
timestamp_created |
datetime
|
Time of creation |
Source code in fractal_server/app/models/security.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
UserOAuth
¶
Bases: SQLModel
ORM model for the user_oauth
database table.
This class is a modification of SQLModelBaseUserDB from from fastapi_users_db_sqlmodel. Original Copyright: 2022 François Voron, released under MIT licence.
Attributes:
Name | Type | Description |
---|---|---|
id |
Optional[int]
|
|
email |
EmailStr
|
|
hashed_password |
str
|
|
is_active |
bool
|
|
is_superuser |
bool
|
|
is_verified |
bool
|
|
slurm_user |
bool
|
|
slurm_accounts |
bool
|
|
username |
Optional[str]
|
|
oauth_accounts |
list[OAuthAccount]
|
|
Source code in fractal_server/app/models/security.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
Workflow
¶
Bases: _WorkflowBaseV1
, SQLModel
Workflow
Attributes:
Name | Type | Description |
---|---|---|
id |
Optional[int]
|
Primary key |
project_id |
int
|
ID of the project the workflow belongs to. |
task_list |
list[WorkflowTask]
|
List of associations to tasks. |
Source code in fractal_server/app/models/v1/workflow.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
WorkflowTask
¶
Bases: _WorkflowTaskBaseV1
, SQLModel
A Task as part of a Workflow
This is a crossing table between Task and Workflow. In addition to the foreign keys, it allows for parameter overriding and keeps the order within the list of tasks of the workflow.
Attributes:
Name | Type | Description |
---|---|---|
id |
Optional[int]
|
Primary key |
workflow_id |
int
|
ID of the |
task_id |
int
|
ID of the task corresponding to the |
order |
Optional[int]
|
Positional order of the |
meta |
Optional[dict[str, Any]]
|
Additional parameters useful for execution |
args |
Optional[dict[str, Any]]
|
Task arguments |
task |
Task
|
|
Source code in fractal_server/app/models/v1/workflow.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
validate_args(value=None)
¶
Prevent fractal task reserved parameter names from entering args
Forbidden argument names are input_paths
, output_path
, metadata
,
component
.
Source code in fractal_server/app/models/v1/workflow.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
get_timestamp()
¶
Get timezone aware timestamp.
Source code in fractal_server/utils.py
28 29 30 31 32 |
|