fractal-server 2.14.0a10__py3-none-any.whl → 2.14.0a12__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/routes/api/v2/submit.py +1 -1
- fractal_server/app/runner/components.py +0 -3
- fractal_server/app/runner/exceptions.py +4 -0
- fractal_server/app/runner/executors/base_runner.py +38 -17
- fractal_server/app/runner/executors/local/{_local_config.py → get_local_config.py} +0 -7
- fractal_server/app/runner/executors/local/runner.py +109 -59
- fractal_server/app/runner/executors/slurm_common/_check_jobs_status.py +4 -0
- fractal_server/app/runner/executors/slurm_ssh/executor.py +7 -5
- fractal_server/app/runner/executors/slurm_ssh/runner.py +6 -10
- fractal_server/app/runner/executors/slurm_sudo/runner.py +196 -99
- fractal_server/app/runner/task_files.py +8 -0
- fractal_server/app/runner/v2/__init__.py +0 -366
- 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/db_tools.py +87 -0
- fractal_server/app/runner/v2/runner.py +77 -81
- fractal_server/app/runner/v2/runner_functions.py +274 -436
- fractal_server/app/runner/v2/runner_functions_low_level.py +37 -39
- fractal_server/app/runner/v2/submit_workflow.py +366 -0
- fractal_server/app/runner/v2/task_interface.py +31 -0
- {fractal_server-2.14.0a10.dist-info → fractal_server-2.14.0a12.dist-info}/METADATA +1 -1
- {fractal_server-2.14.0a10.dist-info → fractal_server-2.14.0a12.dist-info}/RECORD +27 -28
- fractal_server/app/runner/executors/local/_submit_setup.py +0 -46
- fractal_server/app/runner/executors/slurm_common/_submit_setup.py +0 -84
- fractal_server/app/runner/v2/_db_tools.py +0 -48
- {fractal_server-2.14.0a10.dist-info → fractal_server-2.14.0a12.dist-info}/LICENSE +0 -0
- {fractal_server-2.14.0a10.dist-info → fractal_server-2.14.0a12.dist-info}/WHEEL +0 -0
- {fractal_server-2.14.0a10.dist-info → fractal_server-2.14.0a12.dist-info}/entry_points.txt +0 -0
@@ -1,46 +0,0 @@
|
|
1
|
-
from pathlib import Path
|
2
|
-
from typing import Any
|
3
|
-
from typing import Literal
|
4
|
-
|
5
|
-
from ...task_files import TaskFiles
|
6
|
-
from ._local_config import get_local_backend_config
|
7
|
-
from fractal_server.app.models.v2 import WorkflowTaskV2
|
8
|
-
|
9
|
-
|
10
|
-
def _local_submit_setup(
|
11
|
-
*,
|
12
|
-
wftask: WorkflowTaskV2,
|
13
|
-
root_dir_local: Path,
|
14
|
-
root_dir_remote: Path,
|
15
|
-
which_type: Literal["non_parallel", "parallel"],
|
16
|
-
) -> dict[str, Any]:
|
17
|
-
"""
|
18
|
-
Collect WorkflowTask-specific configuration parameters from different
|
19
|
-
sources, and inject them for execution.
|
20
|
-
|
21
|
-
FIXME
|
22
|
-
|
23
|
-
Arguments:
|
24
|
-
wftask: WorkflowTask for which the configuration is to be assembled
|
25
|
-
root_dir_local:
|
26
|
-
root_dir_rempote: Not used in this function.
|
27
|
-
which_type: Whether it is a parallel or non-parallel task.
|
28
|
-
"""
|
29
|
-
|
30
|
-
local_backend_config = get_local_backend_config(
|
31
|
-
wftask=wftask,
|
32
|
-
which_type=which_type,
|
33
|
-
)
|
34
|
-
|
35
|
-
# Get TaskFiles object
|
36
|
-
task_files = TaskFiles(
|
37
|
-
root_dir_local=root_dir_local,
|
38
|
-
root_dir_remote=root_dir_local,
|
39
|
-
task_order=wftask.order,
|
40
|
-
task_name=wftask.task.name,
|
41
|
-
)
|
42
|
-
|
43
|
-
return dict(
|
44
|
-
local_backend_config=local_backend_config,
|
45
|
-
task_files=task_files,
|
46
|
-
)
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# Copyright 2022 (C) Friedrich Miescher Institute for Biomedical Research and
|
2
|
-
# University of Zurich
|
3
|
-
#
|
4
|
-
# Original authors:
|
5
|
-
# Jacopo Nespolo <jacopo.nespolo@exact-lab.it>
|
6
|
-
# Tommaso Comparin <tommaso.comparin@exact-lab.it>
|
7
|
-
#
|
8
|
-
# This file is part of Fractal and was originally developed by eXact lab S.r.l.
|
9
|
-
# <exact-lab.it> under contract with Liberali Lab from the Friedrich Miescher
|
10
|
-
# Institute for Biomedical Research and Pelkmans Lab from the University of
|
11
|
-
# Zurich.
|
12
|
-
"""
|
13
|
-
Submodule to define _slurm_submit_setup, which is also the reference
|
14
|
-
implementation of `submit_setup_call`.
|
15
|
-
"""
|
16
|
-
from pathlib import Path
|
17
|
-
from typing import Any
|
18
|
-
from typing import Literal
|
19
|
-
|
20
|
-
from ...task_files import TaskFiles
|
21
|
-
from fractal_server.app.models.v2 import WorkflowTaskV2
|
22
|
-
from fractal_server.app.runner.executors.slurm_common.get_slurm_config import (
|
23
|
-
get_slurm_config,
|
24
|
-
)
|
25
|
-
|
26
|
-
|
27
|
-
def _slurm_submit_setup(
|
28
|
-
*,
|
29
|
-
wftask: WorkflowTaskV2,
|
30
|
-
root_dir_local: Path,
|
31
|
-
root_dir_remote: Path,
|
32
|
-
which_type: Literal["non_parallel", "parallel"],
|
33
|
-
) -> dict[str, Any]:
|
34
|
-
"""
|
35
|
-
Collect WorkflowTask-specific configuration parameters from different
|
36
|
-
sources, and inject them for execution.
|
37
|
-
|
38
|
-
FIXME
|
39
|
-
|
40
|
-
Here goes all the logic for reading attributes from the appropriate sources
|
41
|
-
and transforming them into an appropriate `SlurmConfig` object (encoding
|
42
|
-
SLURM configuration) and `TaskFiles` object (with details e.g. about file
|
43
|
-
paths or filename prefixes).
|
44
|
-
|
45
|
-
For now, this is the reference implementation for the argument
|
46
|
-
`submit_setup_call` of
|
47
|
-
[fractal_server.app.runner.v2.runner][].
|
48
|
-
|
49
|
-
Arguments:
|
50
|
-
wftask:
|
51
|
-
WorkflowTask for which the configuration is to be assembled
|
52
|
-
workflow_dir_local:
|
53
|
-
Server-owned directory to store all task-execution-related relevant
|
54
|
-
files (inputs, outputs, errors, and all meta files related to the
|
55
|
-
job execution). Note: users cannot write directly to this folder.
|
56
|
-
workflow_dir_remote:
|
57
|
-
User-side directory with the same scope as `workflow_dir_local`,
|
58
|
-
and where a user can write.
|
59
|
-
|
60
|
-
Returns:
|
61
|
-
submit_setup_dict:
|
62
|
-
A dictionary that will be passed on to
|
63
|
-
`FractalSlurmExecutor.submit` and `FractalSlurmExecutor.map`, so
|
64
|
-
as to set extra options.
|
65
|
-
"""
|
66
|
-
|
67
|
-
# Get SlurmConfig object
|
68
|
-
slurm_config = get_slurm_config(
|
69
|
-
wftask=wftask,
|
70
|
-
which_type=which_type,
|
71
|
-
)
|
72
|
-
|
73
|
-
# Get TaskFiles object
|
74
|
-
task_files = TaskFiles(
|
75
|
-
root_dir_local=root_dir_local,
|
76
|
-
root_dir_remote=root_dir_remote,
|
77
|
-
task_order=wftask.order,
|
78
|
-
task_name=wftask.task.name,
|
79
|
-
)
|
80
|
-
|
81
|
-
return dict(
|
82
|
-
slurm_config=slurm_config,
|
83
|
-
task_files=task_files,
|
84
|
-
)
|
@@ -1,48 +0,0 @@
|
|
1
|
-
from typing import Any
|
2
|
-
|
3
|
-
from sqlalchemy.dialects.postgresql import insert as pg_insert
|
4
|
-
from sqlalchemy.orm import Session
|
5
|
-
|
6
|
-
from fractal_server.app.models.v2 import HistoryImageCache
|
7
|
-
|
8
|
-
|
9
|
-
def bulk_upsert_image_cache_fast(
|
10
|
-
*,
|
11
|
-
list_upsert_objects: list[dict[str, Any]],
|
12
|
-
db: Session,
|
13
|
-
) -> None:
|
14
|
-
"""
|
15
|
-
Insert or update many objects into `HistoryImageCache` and commit
|
16
|
-
|
17
|
-
This function is an optimized version of
|
18
|
-
|
19
|
-
```python
|
20
|
-
for obj in list_upsert_objects:
|
21
|
-
db.merge(**obj)
|
22
|
-
db.commit()
|
23
|
-
```
|
24
|
-
|
25
|
-
See docs at
|
26
|
-
https://docs.sqlalchemy.org/en/20/dialects/postgresql.html#insert-on-conflict-upsert
|
27
|
-
|
28
|
-
FIXME: we tried to replace `index_elements` with
|
29
|
-
`constraint="pk_historyimagecache"`, but it did not work as expected.
|
30
|
-
|
31
|
-
Arguments:
|
32
|
-
list_upsert_objects:
|
33
|
-
List of dictionaries for objects to be upsert-ed.
|
34
|
-
db: A sync database session
|
35
|
-
"""
|
36
|
-
if len(list_upsert_objects) == 0:
|
37
|
-
return None
|
38
|
-
stmt = pg_insert(HistoryImageCache).values(list_upsert_objects)
|
39
|
-
stmt = stmt.on_conflict_do_update(
|
40
|
-
index_elements=[
|
41
|
-
HistoryImageCache.zarr_url,
|
42
|
-
HistoryImageCache.dataset_id,
|
43
|
-
HistoryImageCache.workflowtask_id,
|
44
|
-
],
|
45
|
-
set_=dict(latest_history_unit_id=stmt.excluded.latest_history_unit_id),
|
46
|
-
)
|
47
|
-
db.execute(stmt)
|
48
|
-
db.commit()
|
File without changes
|
File without changes
|
File without changes
|