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.
AccountingRecord
¶
Bases: SQLModel
AccountingRecord table.
Source code in fractal_server/app/models/v2/accounting.py
13 14 15 16 17 18 19 20 21 22 23 24 25 | |
AccountingRecordSlurm
¶
Bases: SQLModel
AccountingRecordSlurm table.
Source code in fractal_server/app/models/v2/accounting.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
DatasetV2
¶
Bases: SQLModel
Dataset table.
Source code in fractal_server/app/models/v2/dataset.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 | |
HistoryImageCache
¶
Bases: SQLModel
HistoryImageCache table.
Source code in fractal_server/app/models/v2/history.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
HistoryRun
¶
Bases: SQLModel
HistoryRun table.
Source code in fractal_server/app/models/v2/history.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 | |
HistoryUnit
¶
Bases: SQLModel
HistoryUnit table.
Source code in fractal_server/app/models/v2/history.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
JobV2
¶
Bases: SQLModel
Job table.
Source code in fractal_server/app/models/v2/job.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 | |
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.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
TYPE:
|
user_id |
TYPE:
|
user |
TYPE:
|
oauth_name |
TYPE:
|
access_token |
TYPE:
|
expires_at |
TYPE:
|
refresh_token |
TYPE:
|
account_id |
TYPE:
|
account_email |
TYPE:
|
Source code in fractal_server/app/models/security.py
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 | |
Profile
¶
Bases: SQLModel
Profile table.
Source code in fractal_server/app/models/v2/profile.py
5 6 7 8 9 10 11 12 13 14 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 | |
jobs_remote_dir = None
class-attribute
instance-attribute
¶
Remote path of the job folder (only relevant if
resource_type="slurm_ssh").
name = Field(unique=True)
class-attribute
instance-attribute
¶
Profile name.
resource_type
instance-attribute
¶
Type of resource (either local, slurm_sudo or slurm_ssh).
ssh_key_path = None
class-attribute
instance-attribute
¶
Path to the private SSH key of user username (only relevant if
resource_type="slurm_ssh").
tasks_remote_dir = None
class-attribute
instance-attribute
¶
Remote path of the task folder (only relevant if
resource_type="slurm_ssh").
username = None
class-attribute
instance-attribute
¶
Username to be impersonated, either via sudo -u or via ssh.
ProjectV2
¶
Bases: SQLModel
Project table.
Source code in fractal_server/app/models/v2/project.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
Resource
¶
Bases: SQLModel
Resource table.
Source code in fractal_server/app/models/v2/resource.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 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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
host = None
class-attribute
instance-attribute
¶
Address for ssh connections, when type="slurm_ssh".
jobs_local_dir
instance-attribute
¶
Base local folder for job subfolders (containing artifacts and logs).
jobs_poll_interval
instance-attribute
¶
On SLURM resources: the interval to wait before new squeue calls.
On local resources: ignored.
jobs_runner_config = Field(sa_column=(Column(JSONB, nullable=False, server_default='{}')))
class-attribute
instance-attribute
¶
Runner configuration, matching one of JobRunnerConfigLocal or
JobRunnerConfigSLURM schemas.
jobs_slurm_python_worker = None
class-attribute
instance-attribute
¶
On SLURM deloyments, this is the Python interpreter that runs the
fractal-server worker from within the SLURM jobs.
name = Field(unique=True)
class-attribute
instance-attribute
¶
Resource name.
pip_cache_dir_arg
property
¶
If pip_cache_dir is set (in self.tasks_python_config), then
return --cache_dir /something; else return --no-cache-dir.
tasks_local_dir
instance-attribute
¶
Base local folder for task-package subfolders.
tasks_pixi_config = Field(sa_column=(Column(JSONB, nullable=False, server_default='{}')))
class-attribute
instance-attribute
¶
Pixi configuration for task collection. Basic example:
{
"default_version": "0.41.0",
"versions": {
"0.40.0": "/xxx/pixi/0.40.0/",
"0.41.0": "/xxx/pixi/0.41.0/"
},
}
tasks_python_config = Field(sa_column=(Column(JSONB, nullable=False, server_default='{}')))
class-attribute
instance-attribute
¶
Python configuration for task collection. Example:
{
"default_version": "3.10",
"versions:{
"3.10": "/xxx/venv-3.10/bin/python",
"3.11": "/xxx/venv-3.11/bin/python",
"3.12": "/xxx/venv-3.12/bin/python"
}
}
timestamp_created = Field(default_factory=get_timestamp, sa_column=(Column(DateTime(timezone=True), nullable=False)))
class-attribute
instance-attribute
¶
Creation timestamp (autogenerated).
type
instance-attribute
¶
One of local, slurm_sudo or slurm_ssh - matching with
settings.FRACTAL_RUNNER_BACKEND.
TaskGroupV2
¶
Bases: SQLModel
Source code in fractal_server/app/models/v2/task_group.py
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 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 | |
UserGroup
¶
Bases: SQLModel
ORM model for the usergroup database table.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
ID of the group
TYPE:
|
name |
Name of the group
TYPE:
|
timestamp_created |
Time of creation
TYPE:
|
Source code in fractal_server/app/models/security.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
UserOAuth
¶
Bases: SQLModel
ORM model for the user_oauth database table.
This class is a modification of
SQLModelBaseUserDB
from fastapi_users_db_sqlmodel.
Original Copyright: 2022 François Voron, released under MIT licence.
Note that several class attributes are
the default ones from fastapi-users
.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
TYPE:
|
email |
TYPE:
|
hashed_password |
TYPE:
|
is_active |
If this is
TYPE:
|
is_superuser |
TYPE:
|
is_verified |
If this is
TYPE:
|
oauth_accounts |
TYPE:
|
profile_id |
Foreign key linking the user to a
TYPE:
|
project_dir |
Absolute path of the user's project directory. This is used (A) as
a default base folder for the
TYPE:
|
slurm_accounts |
List of SLURM accounts that the user can select upon running a job.
TYPE:
|
Source code in fractal_server/app/models/security.py
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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
get_timestamp()
¶
Get timezone aware timestamp.
Source code in fractal_server/utils.py
25 26 27 28 29 | |