fractal-server 2.18.0a3__py3-none-any.whl → 2.18.0a5__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 +13 -2
- fractal_server/app/models/v2/resource.py +13 -0
- fractal_server/app/routes/admin/v2/__init__.py +10 -12
- fractal_server/app/routes/admin/v2/job.py +15 -15
- fractal_server/app/routes/admin/v2/task.py +7 -7
- fractal_server/app/routes/admin/v2/task_group.py +11 -11
- fractal_server/app/routes/admin/v2/task_group_lifecycle.py +20 -20
- fractal_server/app/routes/api/v2/__init__.py +47 -49
- fractal_server/app/routes/api/v2/_aux_functions.py +22 -47
- fractal_server/app/routes/api/v2/_aux_functions_task_lifecycle.py +4 -4
- fractal_server/app/routes/api/v2/_aux_functions_tasks.py +2 -2
- fractal_server/app/routes/api/v2/dataset.py +63 -73
- fractal_server/app/routes/api/v2/history.py +7 -5
- fractal_server/app/routes/api/v2/job.py +12 -12
- fractal_server/app/routes/api/v2/project.py +11 -11
- fractal_server/app/routes/api/v2/status_legacy.py +15 -29
- fractal_server/app/routes/api/v2/submit.py +65 -66
- fractal_server/app/routes/api/v2/task.py +15 -17
- fractal_server/app/routes/api/v2/task_collection.py +18 -18
- fractal_server/app/routes/api/v2/task_collection_custom.py +11 -13
- fractal_server/app/routes/api/v2/task_collection_pixi.py +9 -9
- fractal_server/app/routes/api/v2/task_group.py +18 -18
- fractal_server/app/routes/api/v2/task_group_lifecycle.py +26 -26
- fractal_server/app/routes/api/v2/task_version_update.py +5 -5
- fractal_server/app/routes/api/v2/workflow.py +18 -18
- fractal_server/app/routes/api/v2/workflow_import.py +11 -11
- fractal_server/app/routes/api/v2/workflowtask.py +10 -10
- fractal_server/app/routes/auth/_aux_auth.py +99 -0
- fractal_server/app/routes/auth/users.py +9 -0
- fractal_server/app/schemas/user.py +1 -1
- fractal_server/app/schemas/v2/__init__.py +48 -48
- fractal_server/app/schemas/v2/dataset.py +25 -13
- fractal_server/app/schemas/v2/dumps.py +9 -9
- fractal_server/app/schemas/v2/job.py +11 -11
- fractal_server/app/schemas/v2/project.py +3 -3
- fractal_server/app/schemas/v2/resource.py +13 -4
- fractal_server/app/schemas/v2/status_legacy.py +3 -3
- fractal_server/app/schemas/v2/task.py +6 -6
- fractal_server/app/schemas/v2/task_collection.py +4 -4
- fractal_server/app/schemas/v2/task_group.py +16 -16
- fractal_server/app/schemas/v2/workflow.py +16 -16
- fractal_server/app/schemas/v2/workflowtask.py +14 -14
- fractal_server/app/shutdown.py +6 -6
- fractal_server/config/_main.py +1 -1
- fractal_server/data_migrations/{2_18_1.py → 2_18_0.py} +2 -1
- fractal_server/main.py +8 -12
- fractal_server/migrations/versions/88270f589c9b_add_prevent_new_submissions.py +39 -0
- fractal_server/migrations/versions/f0702066b007_one_submitted_job_per_dataset.py +40 -0
- fractal_server/runner/v2/_local.py +3 -2
- fractal_server/runner/v2/_slurm_ssh.py +3 -2
- fractal_server/runner/v2/_slurm_sudo.py +3 -2
- fractal_server/runner/v2/runner.py +36 -17
- fractal_server/runner/v2/runner_functions.py +11 -14
- fractal_server/runner/v2/submit_workflow.py +22 -9
- fractal_server/tasks/v2/local/_utils.py +2 -2
- fractal_server/tasks/v2/local/collect.py +5 -6
- fractal_server/tasks/v2/local/collect_pixi.py +5 -6
- fractal_server/tasks/v2/local/deactivate.py +7 -7
- fractal_server/tasks/v2/local/deactivate_pixi.py +3 -3
- fractal_server/tasks/v2/local/delete.py +5 -5
- fractal_server/tasks/v2/local/reactivate.py +5 -5
- fractal_server/tasks/v2/local/reactivate_pixi.py +5 -5
- fractal_server/tasks/v2/ssh/collect.py +5 -5
- fractal_server/tasks/v2/ssh/collect_pixi.py +5 -5
- fractal_server/tasks/v2/ssh/deactivate.py +7 -7
- fractal_server/tasks/v2/ssh/deactivate_pixi.py +2 -2
- fractal_server/tasks/v2/ssh/delete.py +5 -5
- fractal_server/tasks/v2/ssh/reactivate.py +5 -5
- fractal_server/tasks/v2/ssh/reactivate_pixi.py +5 -5
- fractal_server/tasks/v2/utils_background.py +7 -7
- fractal_server/tasks/v2/utils_database.py +5 -5
- fractal_server/types/__init__.py +13 -4
- fractal_server/types/validators/__init__.py +3 -1
- fractal_server/types/validators/_common_validators.py +23 -1
- {fractal_server-2.18.0a3.dist-info → fractal_server-2.18.0a5.dist-info}/METADATA +1 -1
- {fractal_server-2.18.0a3.dist-info → fractal_server-2.18.0a5.dist-info}/RECORD +80 -78
- {fractal_server-2.18.0a3.dist-info → fractal_server-2.18.0a5.dist-info}/WHEEL +0 -0
- {fractal_server-2.18.0a3.dist-info → fractal_server-2.18.0a5.dist-info}/entry_points.txt +0 -0
- {fractal_server-2.18.0a3.dist-info → fractal_server-2.18.0a5.dist-info}/licenses/LICENSE +0 -0
|
@@ -20,7 +20,7 @@ from fractal_server.app.models.v2 import JobV2
|
|
|
20
20
|
from fractal_server.app.models.v2 import Profile
|
|
21
21
|
from fractal_server.app.models.v2 import Resource
|
|
22
22
|
from fractal_server.app.models.v2 import WorkflowV2
|
|
23
|
-
from fractal_server.app.schemas.v2 import
|
|
23
|
+
from fractal_server.app.schemas.v2 import JobStatusType
|
|
24
24
|
from fractal_server.app.schemas.v2 import ResourceType
|
|
25
25
|
from fractal_server.logger import get_logger
|
|
26
26
|
from fractal_server.logger import reset_logger_handlers
|
|
@@ -71,7 +71,7 @@ def fail_job(
|
|
|
71
71
|
logger.error(log_msg)
|
|
72
72
|
reset_logger_handlers(logger)
|
|
73
73
|
job = db.get(JobV2, job.id) # refetch, in case it was updated
|
|
74
|
-
job.status =
|
|
74
|
+
job.status = JobStatusType.FAILED
|
|
75
75
|
job.end_timestamp = get_timestamp()
|
|
76
76
|
job.log = log_msg
|
|
77
77
|
db.merge(job)
|
|
@@ -145,14 +145,27 @@ def submit_workflow(
|
|
|
145
145
|
return
|
|
146
146
|
if dataset is None or workflow is None:
|
|
147
147
|
log_msg = ""
|
|
148
|
-
if
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
f"Cannot fetch workflow {workflow_id} from database\n"
|
|
148
|
+
if dataset is None:
|
|
149
|
+
current_log_msg = (
|
|
150
|
+
f"Cannot fetch dataset {dataset_id} from database "
|
|
151
|
+
f"(as part of job {job_id})."
|
|
153
152
|
)
|
|
153
|
+
logger.error(current_log_msg)
|
|
154
|
+
log_msg += f"{current_log_msg}\n"
|
|
155
|
+
if workflow is None:
|
|
156
|
+
current_log_msg += (
|
|
157
|
+
f"Cannot fetch workflow {workflow_id} from database "
|
|
158
|
+
f"(as part of job {job_id})."
|
|
159
|
+
)
|
|
160
|
+
logger.error(current_log_msg)
|
|
161
|
+
log_msg += f"{current_log_msg}\n"
|
|
162
|
+
|
|
154
163
|
fail_job(
|
|
155
|
-
db=db_sync,
|
|
164
|
+
db=db_sync,
|
|
165
|
+
job=job,
|
|
166
|
+
log_msg=log_msg,
|
|
167
|
+
logger_name=logger_name,
|
|
168
|
+
emit_log=False,
|
|
156
169
|
)
|
|
157
170
|
return
|
|
158
171
|
|
|
@@ -273,7 +286,7 @@ def submit_workflow(
|
|
|
273
286
|
# Update job DB entry
|
|
274
287
|
with next(DB.get_sync_db()) as db_sync:
|
|
275
288
|
job = db_sync.get(JobV2, job_id)
|
|
276
|
-
job.status =
|
|
289
|
+
job.status = JobStatusType.DONE
|
|
277
290
|
job.end_timestamp = get_timestamp()
|
|
278
291
|
with log_file_path.open("r") as f:
|
|
279
292
|
logs = f.read()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
|
|
3
3
|
from fractal_server.app.models import Resource
|
|
4
|
-
from fractal_server.app.schemas.v2 import
|
|
4
|
+
from fractal_server.app.schemas.v2 import TaskCreate
|
|
5
5
|
from fractal_server.logger import get_logger
|
|
6
6
|
from fractal_server.logger import set_logger
|
|
7
7
|
from fractal_server.tasks.v2.utils_pixi import simplify_pyproject_toml
|
|
@@ -51,7 +51,7 @@ def _customize_and_run_template(
|
|
|
51
51
|
return stdout
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
def check_task_files_exist(task_list: list[
|
|
54
|
+
def check_task_files_exist(task_list: list[TaskCreate]) -> None:
|
|
55
55
|
"""
|
|
56
56
|
Check that the modules listed in task commands point to existing files.
|
|
57
57
|
|
|
@@ -9,8 +9,8 @@ from fractal_server.app.models import Profile
|
|
|
9
9
|
from fractal_server.app.models import Resource
|
|
10
10
|
from fractal_server.app.models.v2 import TaskGroupV2
|
|
11
11
|
from fractal_server.app.schemas.v2 import FractalUploadedFile
|
|
12
|
-
from fractal_server.app.schemas.v2 import
|
|
13
|
-
from fractal_server.app.schemas.v2 import
|
|
12
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityAction
|
|
13
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityStatus
|
|
14
14
|
from fractal_server.app.schemas.v2.manifest import ManifestV2
|
|
15
15
|
from fractal_server.logger import reset_logger_handlers
|
|
16
16
|
from fractal_server.logger import set_logger
|
|
@@ -132,14 +132,13 @@ def collect_local(
|
|
|
132
132
|
Path(task_group.path) / SCRIPTS_SUBFOLDER
|
|
133
133
|
).as_posix(),
|
|
134
134
|
prefix=(
|
|
135
|
-
f"{int(time.time())}_"
|
|
136
|
-
f"{TaskGroupActivityActionV2.COLLECT}"
|
|
135
|
+
f"{int(time.time())}_{TaskGroupActivityAction.COLLECT}"
|
|
137
136
|
),
|
|
138
137
|
logger_name=LOGGER_NAME,
|
|
139
138
|
)
|
|
140
139
|
|
|
141
140
|
# Set status to ONGOING and refresh logs
|
|
142
|
-
activity.status =
|
|
141
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
143
142
|
activity.log = get_current_log(log_file_path)
|
|
144
143
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
145
144
|
|
|
@@ -257,7 +256,7 @@ def collect_local(
|
|
|
257
256
|
|
|
258
257
|
# Finalize (write metadata to DB)
|
|
259
258
|
logger.info("finalising - START")
|
|
260
|
-
activity.status =
|
|
259
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
261
260
|
activity.timestamp_ended = get_timestamp()
|
|
262
261
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
263
262
|
logger.info("finalising - END")
|
|
@@ -8,8 +8,8 @@ from fractal_server.app.db import get_sync_db
|
|
|
8
8
|
from fractal_server.app.models import Profile
|
|
9
9
|
from fractal_server.app.models import Resource
|
|
10
10
|
from fractal_server.app.schemas.v2 import FractalUploadedFile
|
|
11
|
-
from fractal_server.app.schemas.v2 import
|
|
12
|
-
from fractal_server.app.schemas.v2 import
|
|
11
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityAction
|
|
12
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityStatus
|
|
13
13
|
from fractal_server.app.schemas.v2.manifest import ManifestV2
|
|
14
14
|
from fractal_server.logger import reset_logger_handlers
|
|
15
15
|
from fractal_server.logger import set_logger
|
|
@@ -132,13 +132,12 @@ def collect_local_pixi(
|
|
|
132
132
|
task_group.path, SCRIPTS_SUBFOLDER
|
|
133
133
|
).as_posix(),
|
|
134
134
|
prefix=(
|
|
135
|
-
f"{int(time.time())}_"
|
|
136
|
-
f"{TaskGroupActivityActionV2.COLLECT}"
|
|
135
|
+
f"{int(time.time())}_{TaskGroupActivityAction.COLLECT}"
|
|
137
136
|
),
|
|
138
137
|
logger_name=LOGGER_NAME,
|
|
139
138
|
)
|
|
140
139
|
|
|
141
|
-
activity.status =
|
|
140
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
142
141
|
activity.log = get_current_log(log_file_path)
|
|
143
142
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
144
143
|
|
|
@@ -241,7 +240,7 @@ def collect_local_pixi(
|
|
|
241
240
|
|
|
242
241
|
# Finalize (write metadata to DB)
|
|
243
242
|
logger.info("finalising - START")
|
|
244
|
-
activity.status =
|
|
243
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
245
244
|
activity.timestamp_ended = get_timestamp()
|
|
246
245
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
247
246
|
logger.info("finalising - END")
|
|
@@ -6,9 +6,9 @@ from tempfile import TemporaryDirectory
|
|
|
6
6
|
from fractal_server.app.db import get_sync_db
|
|
7
7
|
from fractal_server.app.models import Profile
|
|
8
8
|
from fractal_server.app.models import Resource
|
|
9
|
-
from fractal_server.app.schemas.v2 import
|
|
10
|
-
from fractal_server.app.schemas.v2 import
|
|
11
|
-
from fractal_server.app.schemas.v2.task_group import
|
|
9
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityAction
|
|
10
|
+
from fractal_server.app.schemas.v2 import TaskGroupOriginEnum
|
|
11
|
+
from fractal_server.app.schemas.v2.task_group import TaskGroupActivityStatus
|
|
12
12
|
from fractal_server.logger import reset_logger_handlers
|
|
13
13
|
from fractal_server.logger import set_logger
|
|
14
14
|
from fractal_server.tasks.utils import FORBIDDEN_DEPENDENCY_STRINGS
|
|
@@ -78,7 +78,7 @@ def deactivate_local(
|
|
|
78
78
|
return
|
|
79
79
|
|
|
80
80
|
try:
|
|
81
|
-
activity.status =
|
|
81
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
82
82
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
83
83
|
|
|
84
84
|
if task_group.env_info is None:
|
|
@@ -102,7 +102,7 @@ def deactivate_local(
|
|
|
102
102
|
).as_posix(),
|
|
103
103
|
prefix=(
|
|
104
104
|
f"{int(time.time())}_"
|
|
105
|
-
f"{
|
|
105
|
+
f"{TaskGroupActivityAction.DEACTIVATE}"
|
|
106
106
|
),
|
|
107
107
|
logger_name=LOGGER_NAME,
|
|
108
108
|
)
|
|
@@ -120,7 +120,7 @@ def deactivate_local(
|
|
|
120
120
|
logger.info("Add pip freeze stdout to TaskGroupV2 - end")
|
|
121
121
|
|
|
122
122
|
# Handle some specific cases for wheel-file case
|
|
123
|
-
if task_group.origin ==
|
|
123
|
+
if task_group.origin == TaskGroupOriginEnum.WHEELFILE:
|
|
124
124
|
logger.info(
|
|
125
125
|
f"Handle specific cases for {task_group.origin=}."
|
|
126
126
|
)
|
|
@@ -209,7 +209,7 @@ def deactivate_local(
|
|
|
209
209
|
logger.info(f"Now removing {task_group.venv_path}.")
|
|
210
210
|
shutil.rmtree(task_group.venv_path)
|
|
211
211
|
logger.info(f"All good, {task_group.venv_path} removed.")
|
|
212
|
-
activity.status =
|
|
212
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
213
213
|
activity.log = get_current_log(log_file_path)
|
|
214
214
|
activity.timestamp_ended = get_timestamp()
|
|
215
215
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
@@ -5,7 +5,7 @@ from tempfile import TemporaryDirectory
|
|
|
5
5
|
from fractal_server.app.db import get_sync_db
|
|
6
6
|
from fractal_server.app.models import Profile
|
|
7
7
|
from fractal_server.app.models import Resource
|
|
8
|
-
from fractal_server.app.schemas.v2.task_group import
|
|
8
|
+
from fractal_server.app.schemas.v2.task_group import TaskGroupActivityStatus
|
|
9
9
|
from fractal_server.logger import reset_logger_handlers
|
|
10
10
|
from fractal_server.logger import set_logger
|
|
11
11
|
from fractal_server.tasks.utils import get_log_path
|
|
@@ -70,7 +70,7 @@ def deactivate_local_pixi(
|
|
|
70
70
|
return
|
|
71
71
|
|
|
72
72
|
try:
|
|
73
|
-
activity.status =
|
|
73
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
74
74
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
75
75
|
|
|
76
76
|
# Actually mark the task group as non-active
|
|
@@ -82,7 +82,7 @@ def deactivate_local_pixi(
|
|
|
82
82
|
logger.info(f"Now removing '{source_dir.as_posix()}'.")
|
|
83
83
|
shutil.rmtree(source_dir)
|
|
84
84
|
logger.info(f"All good, '{source_dir.as_posix()}' removed.")
|
|
85
|
-
activity.status =
|
|
85
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
86
86
|
activity.log = get_current_log(log_file_path)
|
|
87
87
|
activity.timestamp_ended = get_timestamp()
|
|
88
88
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
@@ -5,8 +5,8 @@ from tempfile import TemporaryDirectory
|
|
|
5
5
|
from fractal_server.app.db import get_sync_db
|
|
6
6
|
from fractal_server.app.models import Profile
|
|
7
7
|
from fractal_server.app.models import Resource
|
|
8
|
-
from fractal_server.app.schemas.v2 import
|
|
9
|
-
from fractal_server.app.schemas.v2 import
|
|
8
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityStatus
|
|
9
|
+
from fractal_server.app.schemas.v2 import TaskGroupOriginEnum
|
|
10
10
|
from fractal_server.logger import reset_logger_handlers
|
|
11
11
|
from fractal_server.logger import set_logger
|
|
12
12
|
from fractal_server.tasks.utils import get_log_path
|
|
@@ -45,7 +45,7 @@ def delete_local(
|
|
|
45
45
|
return
|
|
46
46
|
|
|
47
47
|
try:
|
|
48
|
-
activity.status =
|
|
48
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
49
49
|
activity.log = get_current_log(log_file_path)
|
|
50
50
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
51
51
|
|
|
@@ -53,12 +53,12 @@ def delete_local(
|
|
|
53
53
|
db.commit()
|
|
54
54
|
logger.debug("Task group removed from database.")
|
|
55
55
|
|
|
56
|
-
if task_group.origin !=
|
|
56
|
+
if task_group.origin != TaskGroupOriginEnum.OTHER:
|
|
57
57
|
logger.debug(f"Removing {task_group.path=}.")
|
|
58
58
|
shutil.rmtree(task_group.path)
|
|
59
59
|
logger.debug(f"{task_group.path=} removed.")
|
|
60
60
|
|
|
61
|
-
activity.status =
|
|
61
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
62
62
|
activity.log = get_current_log(log_file_path)
|
|
63
63
|
activity.timestamp_ended = get_timestamp()
|
|
64
64
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
@@ -6,8 +6,8 @@ from tempfile import TemporaryDirectory
|
|
|
6
6
|
from fractal_server.app.db import get_sync_db
|
|
7
7
|
from fractal_server.app.models import Profile
|
|
8
8
|
from fractal_server.app.models import Resource
|
|
9
|
-
from fractal_server.app.schemas.v2 import
|
|
10
|
-
from fractal_server.app.schemas.v2.task_group import
|
|
9
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityAction
|
|
10
|
+
from fractal_server.app.schemas.v2.task_group import TaskGroupActivityStatus
|
|
11
11
|
from fractal_server.logger import reset_logger_handlers
|
|
12
12
|
from fractal_server.logger import set_logger
|
|
13
13
|
from fractal_server.tasks.utils import get_log_path
|
|
@@ -79,7 +79,7 @@ def reactivate_local(
|
|
|
79
79
|
return
|
|
80
80
|
|
|
81
81
|
try:
|
|
82
|
-
activity.status =
|
|
82
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
83
83
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
84
84
|
|
|
85
85
|
# Prepare replacements for templates
|
|
@@ -105,7 +105,7 @@ def reactivate_local(
|
|
|
105
105
|
).as_posix(),
|
|
106
106
|
prefix=(
|
|
107
107
|
f"{int(time.time())}_"
|
|
108
|
-
f"{
|
|
108
|
+
f"{TaskGroupActivityAction.REACTIVATE}"
|
|
109
109
|
),
|
|
110
110
|
logger_name=LOGGER_NAME,
|
|
111
111
|
)
|
|
@@ -126,7 +126,7 @@ def reactivate_local(
|
|
|
126
126
|
)
|
|
127
127
|
logger.debug("end - install from pip freeze")
|
|
128
128
|
activity.log = get_current_log(log_file_path)
|
|
129
|
-
activity.status =
|
|
129
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
130
130
|
activity.timestamp_ended = get_timestamp()
|
|
131
131
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
132
132
|
task_group.active = True
|
|
@@ -6,8 +6,8 @@ from tempfile import TemporaryDirectory
|
|
|
6
6
|
from fractal_server.app.db import get_sync_db
|
|
7
7
|
from fractal_server.app.models import Profile
|
|
8
8
|
from fractal_server.app.models import Resource
|
|
9
|
-
from fractal_server.app.schemas.v2 import
|
|
10
|
-
from fractal_server.app.schemas.v2.task_group import
|
|
9
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityAction
|
|
10
|
+
from fractal_server.app.schemas.v2.task_group import TaskGroupActivityStatus
|
|
11
11
|
from fractal_server.logger import reset_logger_handlers
|
|
12
12
|
from fractal_server.logger import set_logger
|
|
13
13
|
from fractal_server.tasks.utils import get_log_path
|
|
@@ -77,7 +77,7 @@ def reactivate_local_pixi(
|
|
|
77
77
|
return
|
|
78
78
|
|
|
79
79
|
try:
|
|
80
|
-
activity.status =
|
|
80
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
81
81
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
82
82
|
|
|
83
83
|
common_args = dict(
|
|
@@ -126,7 +126,7 @@ def reactivate_local_pixi(
|
|
|
126
126
|
).as_posix(),
|
|
127
127
|
prefix=(
|
|
128
128
|
f"{int(time.time())}_"
|
|
129
|
-
f"{
|
|
129
|
+
f"{TaskGroupActivityAction.REACTIVATE}"
|
|
130
130
|
),
|
|
131
131
|
logger_name=LOGGER_NAME,
|
|
132
132
|
)
|
|
@@ -176,7 +176,7 @@ def reactivate_local_pixi(
|
|
|
176
176
|
)
|
|
177
177
|
|
|
178
178
|
activity.log = get_current_log(log_file_path)
|
|
179
|
-
activity.status =
|
|
179
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
180
180
|
activity.timestamp_ended = get_timestamp()
|
|
181
181
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
182
182
|
task_group.active = True
|
|
@@ -6,8 +6,8 @@ from fractal_server.app.db import get_sync_db
|
|
|
6
6
|
from fractal_server.app.models import Profile
|
|
7
7
|
from fractal_server.app.models import Resource
|
|
8
8
|
from fractal_server.app.schemas.v2 import FractalUploadedFile
|
|
9
|
-
from fractal_server.app.schemas.v2 import
|
|
10
|
-
from fractal_server.app.schemas.v2 import
|
|
9
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityAction
|
|
10
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityStatus
|
|
11
11
|
from fractal_server.app.schemas.v2.manifest import ManifestV2
|
|
12
12
|
from fractal_server.logger import reset_logger_handlers
|
|
13
13
|
from fractal_server.logger import set_logger
|
|
@@ -166,7 +166,7 @@ def collect_ssh(
|
|
|
166
166
|
script_dir_remote=script_dir_remote,
|
|
167
167
|
prefix=(
|
|
168
168
|
f"{int(time.time())}_"
|
|
169
|
-
f"{
|
|
169
|
+
f"{TaskGroupActivityAction.COLLECT}"
|
|
170
170
|
),
|
|
171
171
|
fractal_ssh=fractal_ssh,
|
|
172
172
|
logger_name=LOGGER_NAME,
|
|
@@ -175,7 +175,7 @@ def collect_ssh(
|
|
|
175
175
|
logger.info("installing - START")
|
|
176
176
|
|
|
177
177
|
# Set status to ONGOING and refresh logs
|
|
178
|
-
activity.status =
|
|
178
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
179
179
|
activity.log = get_current_log(log_file_path)
|
|
180
180
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
181
181
|
|
|
@@ -290,7 +290,7 @@ def collect_ssh(
|
|
|
290
290
|
|
|
291
291
|
# Finalize (write metadata to DB)
|
|
292
292
|
logger.info("finalising - START")
|
|
293
|
-
activity.status =
|
|
293
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
294
294
|
activity.timestamp_ended = get_timestamp()
|
|
295
295
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
296
296
|
logger.info("finalising - END")
|
|
@@ -6,8 +6,8 @@ from fractal_server.app.db import get_sync_db
|
|
|
6
6
|
from fractal_server.app.models import Profile
|
|
7
7
|
from fractal_server.app.models import Resource
|
|
8
8
|
from fractal_server.app.schemas.v2 import FractalUploadedFile
|
|
9
|
-
from fractal_server.app.schemas.v2 import
|
|
10
|
-
from fractal_server.app.schemas.v2 import
|
|
9
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityAction
|
|
10
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityStatus
|
|
11
11
|
from fractal_server.app.schemas.v2.manifest import ManifestV2
|
|
12
12
|
from fractal_server.logger import reset_logger_handlers
|
|
13
13
|
from fractal_server.logger import set_logger
|
|
@@ -184,7 +184,7 @@ def collect_ssh_pixi(
|
|
|
184
184
|
logger.info("installing - START")
|
|
185
185
|
|
|
186
186
|
# Set status to ONGOING and refresh logs
|
|
187
|
-
activity.status =
|
|
187
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
188
188
|
activity.log = get_current_log(log_file_path)
|
|
189
189
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
190
190
|
|
|
@@ -195,7 +195,7 @@ def collect_ssh_pixi(
|
|
|
195
195
|
script_dir_remote=script_dir_remote,
|
|
196
196
|
prefix=(
|
|
197
197
|
f"{int(time.time())}_"
|
|
198
|
-
f"{
|
|
198
|
+
f"{TaskGroupActivityAction.COLLECT}"
|
|
199
199
|
),
|
|
200
200
|
logger_name=LOGGER_NAME,
|
|
201
201
|
fractal_ssh=fractal_ssh,
|
|
@@ -327,7 +327,7 @@ def collect_ssh_pixi(
|
|
|
327
327
|
|
|
328
328
|
# Finalize (write metadata to DB)
|
|
329
329
|
logger.info("finalising - START")
|
|
330
|
-
activity.status =
|
|
330
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
331
331
|
activity.timestamp_ended = get_timestamp()
|
|
332
332
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
333
333
|
logger.info("finalising - END")
|
|
@@ -5,9 +5,9 @@ from tempfile import TemporaryDirectory
|
|
|
5
5
|
from fractal_server.app.db import get_sync_db
|
|
6
6
|
from fractal_server.app.models import Profile
|
|
7
7
|
from fractal_server.app.models import Resource
|
|
8
|
-
from fractal_server.app.schemas.v2 import
|
|
9
|
-
from fractal_server.app.schemas.v2 import
|
|
10
|
-
from fractal_server.app.schemas.v2.task_group import
|
|
8
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityAction
|
|
9
|
+
from fractal_server.app.schemas.v2 import TaskGroupOriginEnum
|
|
10
|
+
from fractal_server.app.schemas.v2.task_group import TaskGroupActivityStatus
|
|
11
11
|
from fractal_server.logger import reset_logger_handlers
|
|
12
12
|
from fractal_server.logger import set_logger
|
|
13
13
|
from fractal_server.ssh._fabric import SingleUseFractalSSH
|
|
@@ -101,7 +101,7 @@ def deactivate_ssh(
|
|
|
101
101
|
)
|
|
102
102
|
return
|
|
103
103
|
|
|
104
|
-
activity.status =
|
|
104
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
105
105
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
106
106
|
|
|
107
107
|
if task_group.env_info is None:
|
|
@@ -135,7 +135,7 @@ def deactivate_ssh(
|
|
|
135
135
|
script_dir_remote=script_dir_remote,
|
|
136
136
|
prefix=(
|
|
137
137
|
f"{int(time.time())}_"
|
|
138
|
-
f"{
|
|
138
|
+
f"{TaskGroupActivityAction.DEACTIVATE}"
|
|
139
139
|
),
|
|
140
140
|
fractal_ssh=fractal_ssh,
|
|
141
141
|
logger_name=LOGGER_NAME,
|
|
@@ -160,7 +160,7 @@ def deactivate_ssh(
|
|
|
160
160
|
)
|
|
161
161
|
|
|
162
162
|
# Handle some specific cases for wheel-file case
|
|
163
|
-
if task_group.origin ==
|
|
163
|
+
if task_group.origin == TaskGroupOriginEnum.WHEELFILE:
|
|
164
164
|
logger.info(
|
|
165
165
|
f"Handle specific cases for {task_group.origin=}."
|
|
166
166
|
)
|
|
@@ -264,7 +264,7 @@ def deactivate_ssh(
|
|
|
264
264
|
safe_root=profile.tasks_remote_dir,
|
|
265
265
|
)
|
|
266
266
|
logger.info(f"All good, {task_group.venv_path} removed.")
|
|
267
|
-
activity.status =
|
|
267
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
268
268
|
activity.log = get_current_log(log_file_path)
|
|
269
269
|
activity.timestamp_ended = get_timestamp()
|
|
270
270
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
@@ -4,7 +4,7 @@ from tempfile import TemporaryDirectory
|
|
|
4
4
|
from fractal_server.app.db import get_sync_db
|
|
5
5
|
from fractal_server.app.models import Profile
|
|
6
6
|
from fractal_server.app.models import Resource
|
|
7
|
-
from fractal_server.app.schemas.v2.task_group import
|
|
7
|
+
from fractal_server.app.schemas.v2.task_group import TaskGroupActivityStatus
|
|
8
8
|
from fractal_server.logger import reset_logger_handlers
|
|
9
9
|
from fractal_server.logger import set_logger
|
|
10
10
|
from fractal_server.ssh._fabric import SingleUseFractalSSH
|
|
@@ -109,7 +109,7 @@ def deactivate_ssh_pixi(
|
|
|
109
109
|
safe_root=profile.tasks_remote_dir,
|
|
110
110
|
)
|
|
111
111
|
logger.info(f"All good, {source_dir} removed.")
|
|
112
|
-
activity.status =
|
|
112
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
113
113
|
activity.log = get_current_log(log_file_path)
|
|
114
114
|
activity.timestamp_ended = get_timestamp()
|
|
115
115
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
@@ -4,8 +4,8 @@ from tempfile import TemporaryDirectory
|
|
|
4
4
|
from fractal_server.app.db import get_sync_db
|
|
5
5
|
from fractal_server.app.models import Profile
|
|
6
6
|
from fractal_server.app.models import Resource
|
|
7
|
-
from fractal_server.app.schemas.v2 import
|
|
8
|
-
from fractal_server.app.schemas.v2 import
|
|
7
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityStatus
|
|
8
|
+
from fractal_server.app.schemas.v2 import TaskGroupOriginEnum
|
|
9
9
|
from fractal_server.logger import reset_logger_handlers
|
|
10
10
|
from fractal_server.logger import set_logger
|
|
11
11
|
from fractal_server.ssh._fabric import SingleUseFractalSSH
|
|
@@ -80,7 +80,7 @@ def delete_ssh(
|
|
|
80
80
|
if not ssh_ok:
|
|
81
81
|
return
|
|
82
82
|
|
|
83
|
-
activity.status =
|
|
83
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
84
84
|
activity.log = get_current_log(log_file_path)
|
|
85
85
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
86
86
|
|
|
@@ -88,7 +88,7 @@ def delete_ssh(
|
|
|
88
88
|
db.commit()
|
|
89
89
|
logger.debug("Task group removed from database.")
|
|
90
90
|
|
|
91
|
-
if task_group.origin !=
|
|
91
|
+
if task_group.origin != TaskGroupOriginEnum.OTHER:
|
|
92
92
|
logger.debug(
|
|
93
93
|
f"Removing remote {task_group.path=} "
|
|
94
94
|
f"(with {profile.tasks_remote_dir=})."
|
|
@@ -99,7 +99,7 @@ def delete_ssh(
|
|
|
99
99
|
)
|
|
100
100
|
logger.debug(f"Remote {task_group.path=} removed.")
|
|
101
101
|
|
|
102
|
-
activity.status =
|
|
102
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
103
103
|
activity.log = get_current_log(log_file_path)
|
|
104
104
|
activity.timestamp_ended = get_timestamp()
|
|
105
105
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
@@ -5,8 +5,8 @@ from tempfile import TemporaryDirectory
|
|
|
5
5
|
from fractal_server.app.db import get_sync_db
|
|
6
6
|
from fractal_server.app.models import Profile
|
|
7
7
|
from fractal_server.app.models import Resource
|
|
8
|
-
from fractal_server.app.schemas.v2 import
|
|
9
|
-
from fractal_server.app.schemas.v2.task_group import
|
|
8
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityAction
|
|
9
|
+
from fractal_server.app.schemas.v2.task_group import TaskGroupActivityStatus
|
|
10
10
|
from fractal_server.logger import reset_logger_handlers
|
|
11
11
|
from fractal_server.logger import set_logger
|
|
12
12
|
from fractal_server.ssh._fabric import SingleUseFractalSSH
|
|
@@ -103,7 +103,7 @@ def reactivate_ssh(
|
|
|
103
103
|
)
|
|
104
104
|
return
|
|
105
105
|
|
|
106
|
-
activity.status =
|
|
106
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
107
107
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
108
108
|
|
|
109
109
|
# Prepare replacements for templates
|
|
@@ -147,7 +147,7 @@ def reactivate_ssh(
|
|
|
147
147
|
script_dir_remote=script_dir_remote,
|
|
148
148
|
prefix=(
|
|
149
149
|
f"{int(time.time())}_"
|
|
150
|
-
f"{
|
|
150
|
+
f"{TaskGroupActivityAction.REACTIVATE}"
|
|
151
151
|
),
|
|
152
152
|
fractal_ssh=fractal_ssh,
|
|
153
153
|
logger_name=LOGGER_NAME,
|
|
@@ -172,7 +172,7 @@ def reactivate_ssh(
|
|
|
172
172
|
)
|
|
173
173
|
logger.info("end - install from pip freeze")
|
|
174
174
|
activity.log = get_current_log(log_file_path)
|
|
175
|
-
activity.status =
|
|
175
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
176
176
|
activity.timestamp_ended = get_timestamp()
|
|
177
177
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
178
178
|
task_group.active = True
|
|
@@ -5,8 +5,8 @@ from tempfile import TemporaryDirectory
|
|
|
5
5
|
from fractal_server.app.db import get_sync_db
|
|
6
6
|
from fractal_server.app.models import Profile
|
|
7
7
|
from fractal_server.app.models import Resource
|
|
8
|
-
from fractal_server.app.schemas.v2 import
|
|
9
|
-
from fractal_server.app.schemas.v2 import
|
|
8
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityAction
|
|
9
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityStatus
|
|
10
10
|
from fractal_server.logger import reset_logger_handlers
|
|
11
11
|
from fractal_server.logger import set_logger
|
|
12
12
|
from fractal_server.ssh._fabric import SingleUseFractalSSH
|
|
@@ -150,7 +150,7 @@ def reactivate_ssh_pixi(
|
|
|
150
150
|
logger.info("installing - START")
|
|
151
151
|
|
|
152
152
|
# Set status to ONGOING and refresh logs
|
|
153
|
-
activity.status =
|
|
153
|
+
activity.status = TaskGroupActivityStatus.ONGOING
|
|
154
154
|
activity.log = get_current_log(log_file_path)
|
|
155
155
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
156
156
|
|
|
@@ -164,7 +164,7 @@ def reactivate_ssh_pixi(
|
|
|
164
164
|
script_dir_remote=script_dir_remote,
|
|
165
165
|
prefix=(
|
|
166
166
|
f"{int(time.time())}_"
|
|
167
|
-
f"{
|
|
167
|
+
f"{TaskGroupActivityAction.REACTIVATE}"
|
|
168
168
|
),
|
|
169
169
|
logger_name=LOGGER_NAME,
|
|
170
170
|
fractal_ssh=fractal_ssh,
|
|
@@ -247,7 +247,7 @@ def reactivate_ssh_pixi(
|
|
|
247
247
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
248
248
|
|
|
249
249
|
# Finalize (write metadata to DB)
|
|
250
|
-
activity.status =
|
|
250
|
+
activity.status = TaskGroupActivityStatus.OK
|
|
251
251
|
activity.timestamp_ended = get_timestamp()
|
|
252
252
|
activity = add_commit_refresh(obj=activity, db=db)
|
|
253
253
|
task_group.active = True
|
|
@@ -6,10 +6,10 @@ from sqlalchemy.orm import Session as DBSyncSession
|
|
|
6
6
|
|
|
7
7
|
from fractal_server.app.models.v2 import TaskGroupActivityV2
|
|
8
8
|
from fractal_server.app.models.v2 import TaskGroupV2
|
|
9
|
-
from fractal_server.app.schemas.v2 import
|
|
10
|
-
from fractal_server.app.schemas.v2 import
|
|
9
|
+
from fractal_server.app.schemas.v2 import TaskCreate
|
|
10
|
+
from fractal_server.app.schemas.v2 import TaskGroupActivityStatus
|
|
11
11
|
from fractal_server.app.schemas.v2.manifest import ManifestV2
|
|
12
|
-
from fractal_server.app.schemas.v2.task_group import
|
|
12
|
+
from fractal_server.app.schemas.v2.task_group import TaskGroupActivityAction
|
|
13
13
|
from fractal_server.exceptions import UnreachableBranchError
|
|
14
14
|
from fractal_server.logger import get_logger
|
|
15
15
|
from fractal_server.logger import reset_logger_handlers
|
|
@@ -66,11 +66,11 @@ def fail_and_cleanup(
|
|
|
66
66
|
f"Original error: {str(exception)}"
|
|
67
67
|
)
|
|
68
68
|
|
|
69
|
-
task_group_activity.status =
|
|
69
|
+
task_group_activity.status = TaskGroupActivityStatus.FAILED
|
|
70
70
|
task_group_activity.timestamp_ended = get_timestamp()
|
|
71
71
|
task_group_activity.log = get_current_log(log_file_path)
|
|
72
72
|
task_group_activity = add_commit_refresh(obj=task_group_activity, db=db)
|
|
73
|
-
if task_group_activity.action ==
|
|
73
|
+
if task_group_activity.action == TaskGroupActivityAction.COLLECT:
|
|
74
74
|
db.delete(task_group)
|
|
75
75
|
db.commit()
|
|
76
76
|
reset_logger_handlers(logger)
|
|
@@ -83,7 +83,7 @@ def prepare_tasks_metadata(
|
|
|
83
83
|
python_bin: Path | None = None,
|
|
84
84
|
project_python_wrapper: Path | None = None,
|
|
85
85
|
package_version: str | None = None,
|
|
86
|
-
) -> list[
|
|
86
|
+
) -> list[TaskCreate]:
|
|
87
87
|
"""
|
|
88
88
|
Based on the package manifest and additional info, prepare the task list.
|
|
89
89
|
|
|
@@ -129,7 +129,7 @@ def prepare_tasks_metadata(
|
|
|
129
129
|
)
|
|
130
130
|
task_attributes["command_parallel"] = cmd_parallel
|
|
131
131
|
# Create object
|
|
132
|
-
task_obj =
|
|
132
|
+
task_obj = TaskCreate(
|
|
133
133
|
**_task.model_dump(
|
|
134
134
|
exclude={
|
|
135
135
|
"executable_non_parallel",
|