fractal-server 2.14.3__py3-none-any.whl → 2.14.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fractal_server/__init__.py +1 -1
- fractal_server/app/models/v2/job.py +2 -2
- fractal_server/app/routes/api/v2/images.py +4 -20
- fractal_server/app/routes/api/v2/pre_submission_checks.py +2 -2
- fractal_server/app/runner/{run_subprocess.py → executors/slurm_ssh/run_subprocess.py} +11 -6
- fractal_server/app/runner/executors/slurm_ssh/runner.py +11 -56
- fractal_server/app/runner/executors/slurm_ssh/tar_commands.py +65 -0
- fractal_server/app/runner/v2/_local.py +2 -2
- fractal_server/app/runner/v2/_slurm_ssh.py +2 -2
- fractal_server/app/runner/v2/_slurm_sudo.py +2 -2
- fractal_server/app/runner/v2/runner.py +2 -2
- fractal_server/app/runner/v2/task_interface.py +3 -14
- fractal_server/app/schemas/user.py +11 -35
- fractal_server/app/schemas/user_group.py +3 -23
- fractal_server/app/schemas/user_settings.py +17 -43
- fractal_server/app/schemas/v2/dataset.py +10 -50
- fractal_server/app/schemas/v2/job.py +19 -60
- fractal_server/app/schemas/v2/manifest.py +10 -25
- fractal_server/app/schemas/v2/project.py +3 -11
- fractal_server/app/schemas/v2/task.py +36 -106
- fractal_server/app/schemas/v2/task_collection.py +31 -81
- fractal_server/app/schemas/v2/task_group.py +14 -34
- fractal_server/app/schemas/v2/workflow.py +13 -28
- fractal_server/app/schemas/v2/workflowtask.py +18 -126
- fractal_server/config.py +20 -73
- fractal_server/images/models.py +15 -81
- fractal_server/images/tools.py +3 -3
- fractal_server/ssh/_fabric.py +4 -1
- fractal_server/types/__init__.py +87 -0
- fractal_server/types/validators/__init__.py +6 -0
- fractal_server/types/validators/_common_validators.py +42 -0
- fractal_server/types/validators/_filter_validators.py +24 -0
- fractal_server/types/validators/_workflow_task_arguments_validators.py +10 -0
- {fractal_server-2.14.3.dist-info → fractal_server-2.14.4.dist-info}/METADATA +1 -1
- {fractal_server-2.14.3.dist-info → fractal_server-2.14.4.dist-info}/RECORD +38 -36
- fractal_server/app/runner/compress_folder.py +0 -125
- fractal_server/app/runner/extract_archive.py +0 -99
- fractal_server/app/schemas/_filter_validators.py +0 -46
- fractal_server/app/schemas/_validators.py +0 -86
- {fractal_server-2.14.3.dist-info → fractal_server-2.14.4.dist-info}/LICENSE +0 -0
- {fractal_server-2.14.3.dist-info → fractal_server-2.14.4.dist-info}/WHEEL +0 -0
- {fractal_server-2.14.3.dist-info → fractal_server-2.14.4.dist-info}/entry_points.txt +0 -0
@@ -1,86 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
from typing import Annotated
|
3
|
-
from typing import Any
|
4
|
-
from typing import Optional
|
5
|
-
|
6
|
-
from pydantic.types import StringConstraints
|
7
|
-
|
8
|
-
|
9
|
-
def cant_set_none(value: Any) -> Any:
|
10
|
-
if value is None:
|
11
|
-
raise ValueError("Field cannot be set to 'None'.")
|
12
|
-
return value
|
13
|
-
|
14
|
-
|
15
|
-
NonEmptyString = Annotated[
|
16
|
-
str, StringConstraints(min_length=1, strip_whitespace=True)
|
17
|
-
]
|
18
|
-
|
19
|
-
|
20
|
-
def valdict_keys(attribute: str):
|
21
|
-
def val(cls, d: Optional[dict[str, Any]]) -> Optional[dict[str, Any]]:
|
22
|
-
"""
|
23
|
-
Strip every key of the dictionary, and fail if there are identical keys
|
24
|
-
"""
|
25
|
-
if d is not None:
|
26
|
-
old_keys = list(d.keys())
|
27
|
-
new_keys = [key.strip() for key in old_keys]
|
28
|
-
if any(k == "" for k in new_keys):
|
29
|
-
raise ValueError(f"Empty string in {new_keys}.")
|
30
|
-
if len(new_keys) != len(set(new_keys)):
|
31
|
-
raise ValueError(
|
32
|
-
f"Dictionary contains multiple identical keys: '{d}'."
|
33
|
-
)
|
34
|
-
for old_key, new_key in zip(old_keys, new_keys):
|
35
|
-
if new_key != old_key:
|
36
|
-
d[new_key] = d.pop(old_key)
|
37
|
-
return d
|
38
|
-
|
39
|
-
return val
|
40
|
-
|
41
|
-
|
42
|
-
def val_absolute_path(attribute: str, accept_none: bool = False):
|
43
|
-
"""
|
44
|
-
Check that a string attribute is an absolute path
|
45
|
-
"""
|
46
|
-
|
47
|
-
def val(cls, string: Optional[str]) -> Optional[str]:
|
48
|
-
if string is None:
|
49
|
-
if accept_none:
|
50
|
-
return string
|
51
|
-
else:
|
52
|
-
raise ValueError(
|
53
|
-
f"String attribute '{attribute}' cannot be None"
|
54
|
-
)
|
55
|
-
s = string.strip()
|
56
|
-
if not s:
|
57
|
-
raise ValueError(f"String attribute '{attribute}' cannot be empty")
|
58
|
-
if not os.path.isabs(s):
|
59
|
-
raise ValueError(
|
60
|
-
f"String attribute '{attribute}' must be an absolute path "
|
61
|
-
f"(given '{s}')."
|
62
|
-
)
|
63
|
-
return s
|
64
|
-
|
65
|
-
return val
|
66
|
-
|
67
|
-
|
68
|
-
def val_unique_list(attribute: str):
|
69
|
-
def val(cls, must_be_unique: Optional[list]) -> Optional[list]:
|
70
|
-
if must_be_unique is not None:
|
71
|
-
if len(set(must_be_unique)) != len(must_be_unique):
|
72
|
-
raise ValueError(f"`{attribute}` list has repetitions")
|
73
|
-
return must_be_unique
|
74
|
-
|
75
|
-
return val
|
76
|
-
|
77
|
-
|
78
|
-
def root_validate_dict_keys(cls, object: dict) -> dict:
|
79
|
-
"""
|
80
|
-
For each dictionary in `object.values()`,
|
81
|
-
checks that that dictionary has only keys of type str.
|
82
|
-
"""
|
83
|
-
for dictionary in (v for v in object.values() if isinstance(v, dict)):
|
84
|
-
if not all(isinstance(key, str) for key in dictionary.keys()):
|
85
|
-
raise ValueError("Dictionary keys must be strings.")
|
86
|
-
return object
|
File without changes
|
File without changes
|
File without changes
|