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
@@ -6,12 +6,16 @@ from typing import Literal
6
6
 
7
7
  from .get_local_config import LocalBackendConfig
8
8
  from fractal_server.app.db import get_sync_db
9
+ from fractal_server.app.runner.exceptions import TaskExecutionError
9
10
  from fractal_server.app.runner.executors.base_runner import BaseRunner
11
+ from fractal_server.app.runner.task_files import MULTISUBMIT_PREFIX
12
+ from fractal_server.app.runner.task_files import SUBMIT_PREFIX
10
13
  from fractal_server.app.runner.task_files import TaskFiles
11
14
  from fractal_server.app.runner.v2.db_tools import update_status_of_history_unit
12
15
  from fractal_server.app.schemas.v2 import HistoryUnitStatus
13
16
  from fractal_server.logger import set_logger
14
17
 
18
+
15
19
  logger = set_logger(__name__)
16
20
 
17
21
 
@@ -65,6 +69,8 @@ class LocalRunner(BaseRunner):
65
69
  workdir_local = task_files.wftask_subfolder_local
66
70
  workdir_local.mkdir()
67
71
 
72
+ task_files.prefix = SUBMIT_PREFIX
73
+
68
74
  # SUBMISSION PHASE
69
75
  future = self.executor.submit(
70
76
  func,
@@ -85,15 +91,13 @@ class LocalRunner(BaseRunner):
85
91
  )
86
92
  return result, None
87
93
  except Exception as e:
88
- exception = e
89
94
  logger.debug("[submit] END with exception")
90
95
  update_status_of_history_unit(
91
96
  history_unit_id=history_unit_id,
92
97
  status=HistoryUnitStatus.FAILED,
93
98
  db_sync=db,
94
99
  )
95
-
96
- return None, exception
100
+ return None, TaskExecutionError(str(e))
97
101
 
98
102
  def multisubmit(
99
103
  self,
@@ -151,12 +155,14 @@ class LocalRunner(BaseRunner):
151
155
  active_futures: dict[int, Future] = {}
152
156
  for ind_within_chunk, kwargs in enumerate(list_parameters_chunk):
153
157
  positional_index = ind_chunk + ind_within_chunk
158
+ current_task_files = list_task_files[positional_index]
159
+ current_task_files.prefix = (
160
+ f"{MULTISUBMIT_PREFIX}-{positional_index:06d}"
161
+ )
154
162
  future = self.executor.submit(
155
163
  func,
156
164
  parameters=kwargs,
157
- remote_files=list_task_files[
158
- positional_index
159
- ].remote_files_dict,
165
+ remote_files=current_task_files.remote_files_dict,
160
166
  )
161
167
  active_futures[positional_index] = future
162
168
 
@@ -189,7 +195,9 @@ class LocalRunner(BaseRunner):
189
195
  )
190
196
 
191
197
  except Exception as e:
192
- exceptions[positional_index] = e
198
+ exceptions[positional_index] = TaskExecutionError(
199
+ str(e)
200
+ )
193
201
  if task_type == "parallel":
194
202
  update_status_of_history_unit(
195
203
  history_unit_id=current_history_unit_id,
@@ -0,0 +1,17 @@
1
+ from fractal_server.app.runner.exceptions import JobExecutionError
2
+ from fractal_server.app.runner.exceptions import TaskExecutionError
3
+
4
+
5
+ def _handle_exception_proxy(proxy): # FIXME
6
+ if proxy.exc_type_name == "JobExecutionError":
7
+ return JobExecutionError(str(proxy))
8
+ else:
9
+ kwargs = {}
10
+ for key in [
11
+ "workflow_task_id",
12
+ "workflow_task_order",
13
+ "task_name",
14
+ ]:
15
+ if key in proxy.kwargs.keys():
16
+ kwargs[key] = proxy.kwargs[key]
17
+ return TaskExecutionError(proxy.tb, **kwargs)