fractal-server 2.14.0a13__py3-none-any.whl → 2.14.0a15__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.
Files changed (46) hide show
  1. fractal_server/__init__.py +1 -1
  2. fractal_server/app/models/linkusergroup.py +6 -2
  3. fractal_server/app/models/v2/dataset.py +1 -1
  4. fractal_server/app/models/v2/job.py +7 -3
  5. fractal_server/app/models/v2/task_group.py +2 -2
  6. fractal_server/app/models/v2/workflow.py +1 -1
  7. fractal_server/app/models/v2/workflowtask.py +1 -1
  8. fractal_server/app/routes/admin/v2/task_group.py +0 -17
  9. fractal_server/app/routes/api/v2/_aux_functions_history.py +8 -0
  10. fractal_server/app/routes/api/v2/dataset.py +0 -8
  11. fractal_server/app/routes/api/v2/history.py +111 -27
  12. fractal_server/app/routes/api/v2/images.py +16 -14
  13. fractal_server/app/routes/api/v2/project.py +0 -52
  14. fractal_server/app/routes/api/v2/task_group.py +0 -17
  15. fractal_server/app/routes/api/v2/workflow.py +0 -8
  16. fractal_server/app/routes/auth/group.py +0 -16
  17. fractal_server/app/runner/executors/base_runner.py +5 -0
  18. fractal_server/app/runner/executors/local/runner.py +15 -7
  19. fractal_server/app/runner/executors/slurm_common/_handle_exception_proxy.py +17 -0
  20. fractal_server/app/runner/executors/slurm_common/base_slurm_runner.py +677 -0
  21. fractal_server/app/runner/executors/slurm_common/slurm_job_task_models.py +102 -0
  22. fractal_server/app/runner/executors/slurm_ssh/runner.py +110 -648
  23. fractal_server/app/runner/executors/slurm_sudo/runner.py +32 -661
  24. fractal_server/app/runner/task_files.py +20 -6
  25. fractal_server/app/runner/v2/_slurm_ssh.py +6 -6
  26. fractal_server/app/runner/v2/_slurm_sudo.py +4 -4
  27. fractal_server/app/runner/v2/runner.py +4 -0
  28. fractal_server/app/runner/v2/runner_functions.py +2 -2
  29. fractal_server/app/runner/v2/submit_workflow.py +7 -16
  30. fractal_server/app/schemas/v2/__init__.py +3 -1
  31. fractal_server/app/schemas/v2/history.py +27 -2
  32. fractal_server/config.py +6 -2
  33. fractal_server/images/tools.py +23 -0
  34. fractal_server/migrations/versions/5b6007027595_on_cascade.py +250 -0
  35. fractal_server/migrations/versions/fbce16ff4e47_new_history_items.py +2 -2
  36. fractal_server/tasks/v2/utils_background.py +0 -19
  37. {fractal_server-2.14.0a13.dist-info → fractal_server-2.14.0a15.dist-info}/METADATA +1 -1
  38. {fractal_server-2.14.0a13.dist-info → fractal_server-2.14.0a15.dist-info}/RECORD +41 -42
  39. fractal_server/app/runner/executors/slurm_common/_check_jobs_status.py +0 -77
  40. fractal_server/app/runner/executors/slurm_ssh/_check_job_status_ssh.py +0 -67
  41. fractal_server/app/runner/executors/slurm_ssh/_executor_wait_thread.py +0 -126
  42. fractal_server/app/runner/executors/slurm_ssh/_slurm_job.py +0 -116
  43. fractal_server/app/runner/executors/slurm_ssh/executor.py +0 -1386
  44. {fractal_server-2.14.0a13.dist-info → fractal_server-2.14.0a15.dist-info}/LICENSE +0 -0
  45. {fractal_server-2.14.0a13.dist-info → fractal_server-2.14.0a15.dist-info}/WHEEL +0 -0
  46. {fractal_server-2.14.0a13.dist-info → fractal_server-2.14.0a15.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,102 @@
1
+ from pathlib import Path
2
+ from typing import Any
3
+ from typing import Optional
4
+
5
+ from pydantic import BaseModel
6
+ from pydantic import ConfigDict
7
+
8
+ from fractal_server.app.runner.task_files import TaskFiles
9
+
10
+
11
+ class SlurmTask(BaseModel):
12
+ model_config = ConfigDict(arbitrary_types_allowed=True)
13
+ component: str
14
+ prefix: str
15
+ workdir_local: Path
16
+ workdir_remote: Path
17
+ parameters: dict[str, Any]
18
+ zarr_url: Optional[str] = None
19
+ task_files: TaskFiles
20
+ index: int
21
+
22
+ @property
23
+ def input_pickle_file_local(self) -> str:
24
+ return (
25
+ self.workdir_local / f"{self.prefix}-{self.component}-input.pickle"
26
+ ).as_posix()
27
+
28
+ @property
29
+ def input_pickle_file_remote(self) -> str:
30
+ return (
31
+ self.workdir_remote
32
+ / f"{self.prefix}-{self.component}-input.pickle"
33
+ ).as_posix()
34
+
35
+ @property
36
+ def output_pickle_file_local(self) -> str:
37
+ return (
38
+ self.workdir_local
39
+ / f"{self.prefix}-{self.component}-output.pickle"
40
+ ).as_posix()
41
+
42
+ @property
43
+ def output_pickle_file_remote(self) -> str:
44
+ return (
45
+ self.workdir_remote
46
+ / f"{self.prefix}-{self.component}-output.pickle"
47
+ ).as_posix()
48
+
49
+
50
+ class SlurmJob(BaseModel):
51
+ slurm_job_id: Optional[str] = None
52
+ prefix: str
53
+ workdir_local: Path
54
+ workdir_remote: Path
55
+ tasks: list[SlurmTask]
56
+
57
+ @property
58
+ def slurm_submission_script_local(self) -> str:
59
+ return (
60
+ self.workdir_local / f"{self.prefix}-slurm-submit.sh"
61
+ ).as_posix()
62
+
63
+ @property
64
+ def slurm_submission_script_remote(self) -> str:
65
+ return (
66
+ self.workdir_remote / f"{self.prefix}-slurm-submit.sh"
67
+ ).as_posix()
68
+
69
+ @property
70
+ def slurm_job_id_placeholder(self) -> str:
71
+ if self.slurm_job_id:
72
+ return self.slurm_job_id
73
+ else:
74
+ return "%j"
75
+
76
+ @property
77
+ def slurm_stdout_remote(self) -> str:
78
+ return (
79
+ self.workdir_remote
80
+ / f"{self.prefix}-slurm-{self.slurm_job_id_placeholder}.out"
81
+ ).as_posix()
82
+
83
+ @property
84
+ def slurm_stderr_remote(self) -> str:
85
+ return (
86
+ self.workdir_remote
87
+ / f"{self.prefix}-slurm-{self.slurm_job_id_placeholder}.err"
88
+ ).as_posix()
89
+
90
+ @property
91
+ def slurm_stdout_local(self) -> str:
92
+ return (
93
+ self.workdir_local
94
+ / f"{self.prefix}-slurm-{self.slurm_job_id_placeholder}.out"
95
+ ).as_posix()
96
+
97
+ @property
98
+ def slurm_stderr_local(self) -> str:
99
+ return (
100
+ self.workdir_local
101
+ / f"{self.prefix}-slurm-{self.slurm_job_id_placeholder}.err"
102
+ ).as_posix()