Skip to content

profile

ProfileRead

Bases: BaseModel

Profile schema for GET endpoints.

ATTRIBUTE DESCRIPTION
id

TYPE: int

name

TYPE: str

resource_id

TYPE: int

resource_type

TYPE: str

username

TYPE: str | None

ssh_key_path

TYPE: str | None

jobs_remote_dir

TYPE: str | None

tasks_remote_dir

TYPE: str | None

Source code in fractal_server/app/schemas/v2/profile.py
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
class ProfileRead(BaseModel):
    """
    Profile schema for GET endpoints.

    Attributes:
        id:
        name:
        resource_id:
        resource_type:
        username:
        ssh_key_path:
        jobs_remote_dir:
        tasks_remote_dir:
    """

    id: int
    name: str
    resource_id: int
    resource_type: str
    username: str | None = None
    ssh_key_path: str | None = None
    jobs_remote_dir: str | None = None
    tasks_remote_dir: str | None = None

ValidProfileLocal

Bases: BaseModel

Valid local profile.

ATTRIBUTE DESCRIPTION
name

Profile name.

TYPE: NonEmptyStr

resource_type

Type of the corresponding resource.

TYPE: ResourceType

Source code in fractal_server/app/schemas/v2/profile.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class ValidProfileLocal(BaseModel):
    """
    Valid local profile.

    Attributes:
        name: Profile name.
        resource_type: Type of the corresponding resource.
    """

    name: NonEmptyStr
    resource_type: ResourceType
    username: None = None
    ssh_key_path: None = None
    jobs_remote_dir: None = None
    tasks_remote_dir: None = None

ValidProfileSlurmSSH

Bases: BaseModel

Valid SLURM/sudo profile.

ATTRIBUTE DESCRIPTION
name

Profile name.

TYPE: NonEmptyStr

resource_type

Type of the corresponding resource.

TYPE: ResourceType

username

SLURM user to impersonate (e.g. as in ssh username@cluster sbatch /some/script.sh).

TYPE: NonEmptyStr

ssh_key_path

Local path of SSH private key for user username.

TYPE: AbsolutePathStr

tasks_remote_dir

Base folder for task environments on the remote SLURM cluster.

TYPE: AbsolutePathStr

jobs_remote_dir

Base folder for job directories on the remote SLURM cluster.

TYPE: AbsolutePathStr

Source code in fractal_server/app/schemas/v2/profile.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
class ValidProfileSlurmSSH(BaseModel):
    """
    Valid SLURM/sudo profile.

    Attributes:
        name: Profile name.
        resource_type: Type of the corresponding resource.
        username:
            SLURM user to impersonate (e.g. as in
            `ssh username@cluster sbatch /some/script.sh`).
        ssh_key_path:
            Local path of SSH private key for user `username`.
        tasks_remote_dir:
            Base folder for task environments on the remote SLURM cluster.
        jobs_remote_dir:
            Base folder for job directories on the remote SLURM cluster.
    """

    name: NonEmptyStr
    resource_type: ResourceType
    username: NonEmptyStr
    ssh_key_path: AbsolutePathStr
    jobs_remote_dir: AbsolutePathStr
    tasks_remote_dir: AbsolutePathStr

ValidProfileSlurmSudo

Bases: BaseModel

Valid SLURM/sudo profile.

ATTRIBUTE DESCRIPTION
name

Profile name.

TYPE: NonEmptyStr

resource_type

Type of the corresponding resource.

TYPE: ResourceType

username

SLURM user to impersonate (e.g. as in sudo -u username sbatch /some/script.sh).

TYPE: NonEmptyStr

Source code in fractal_server/app/schemas/v2/profile.py
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class ValidProfileSlurmSudo(BaseModel):
    """
    Valid SLURM/sudo profile.

    Attributes:
        name: Profile name.
        resource_type: Type of the corresponding resource.
        username:
            SLURM user to impersonate (e.g. as in
            `sudo -u username sbatch /some/script.sh`).
    """

    name: NonEmptyStr
    resource_type: ResourceType
    username: NonEmptyStr
    ssh_key_path: None = None
    jobs_remote_dir: None = None
    tasks_remote_dir: None = None

cast_serialize_profile(_data)

Cast/serialize round-trip for Profile data.

We use @validate_call because ProfileCreate is a Union type and it cannot be instantiated directly.

Return

Serialized version of a valid profile object.

Source code in fractal_server/app/schemas/v2/profile.py
117
118
119
120
121
122
123
124
125
126
127
128
@validate_call
def cast_serialize_profile(_data: ProfileCreate) -> dict[str, Any]:
    """
    Cast/serialize round-trip for `Profile` data.

    We use `@validate_call` because `ProfileCreate` is a `Union` type and it
    cannot be instantiated directly.

    Return:
        Serialized version of a valid profile object.
    """
    return _data.model_dump()