fractal-server 2.0.2__py3-none-any.whl → 2.0.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.
@@ -1 +1 @@
1
- __VERSION__ = "2.0.2"
1
+ __VERSION__ = "2.0.4"
@@ -489,6 +489,10 @@ class FractalSlurmExecutor(SlurmExecutor):
489
489
  if len(args_batches) != math.ceil(tot_tasks / tasks_per_job):
490
490
  raise RuntimeError("Something wrong here while batching tasks")
491
491
 
492
+ # Fetch configuration variable
493
+ settings = Inject(get_settings)
494
+ FRACTAL_SLURM_SBATCH_SLEEP = settings.FRACTAL_SLURM_SBATCH_SLEEP
495
+
492
496
  # Construct list of futures (one per SLURM job, i.e. one per batch)
493
497
  fs = []
494
498
  current_component_index = 0
@@ -508,6 +512,7 @@ class FractalSlurmExecutor(SlurmExecutor):
508
512
  )
509
513
  )
510
514
  current_component_index += batch_size
515
+ time.sleep(FRACTAL_SLURM_SBATCH_SLEEP)
511
516
 
512
517
  # Yield must be hidden in closure so that the futures are submitted
513
518
  # before the first iterator value is required.
fractal_server/config.py CHANGED
@@ -331,6 +331,12 @@ class Settings(BaseSettings):
331
331
  [`clusterfutures`](https://github.com/sampsyo/clusterfutures/blob/master/cfut/__init__.py)).
332
332
  """
333
333
 
334
+ FRACTAL_SLURM_SBATCH_SLEEP: int = 0
335
+ """
336
+ Interval to wait (in seconds) between two subsequent `sbatch` calls, when
337
+ running a task that produces multiple SLURM jobs.
338
+ """
339
+
334
340
  FRACTAL_SLURM_ERROR_HANDLING_INTERVAL: int = 5
335
341
  """
336
342
  Interval to wait (in seconds) when the SLURM backend does not find an
@@ -0,0 +1,79 @@
1
+ import logging
2
+
3
+ from packaging.version import parse
4
+ from sqlalchemy import select
5
+ from sqlalchemy.orm.attributes import flag_modified
6
+
7
+ import fractal_server
8
+ from fractal_server.app.db import get_sync_db
9
+ from fractal_server.app.models.v1 import ApplyWorkflow
10
+ from fractal_server.app.models.v2 import JobV2
11
+ from fractal_server.app.schemas.v1 import ApplyWorkflowReadV1
12
+ from fractal_server.app.schemas.v2 import JobReadV2
13
+
14
+
15
+ def fix_db():
16
+ logger = logging.getLogger("fix_db")
17
+ logger.warning("START execution of fix_db function")
18
+
19
+ # Check that this module matches with the current version
20
+ module_version = parse("2.0.3")
21
+ current_version = parse(fractal_server.__VERSION__)
22
+ if (
23
+ current_version.major != module_version.major
24
+ or current_version.minor != module_version.minor
25
+ or current_version.micro != module_version.micro
26
+ ):
27
+ raise RuntimeError(
28
+ f"{fractal_server.__VERSION__=} not matching with {__file__=}"
29
+ )
30
+
31
+ with next(get_sync_db()) as db:
32
+
33
+ # V1 jobs
34
+ stm = select(ApplyWorkflow)
35
+ jobs_v1 = db.execute(stm).scalars().all()
36
+ for job_v1 in sorted(jobs_v1, key=lambda x: x.id):
37
+ for KEY in ["history"]:
38
+ logger.warning(
39
+ f"Now removing {KEY} from `input/output_dataset_dump`, "
40
+ f"for appplyworkflow.id={job_v1.id}."
41
+ )
42
+ if KEY in job_v1.input_dataset_dump.keys():
43
+ job_v1.input_dataset_dump.pop(KEY)
44
+ if KEY in job_v1.output_dataset_dump.keys():
45
+ job_v1.output_dataset_dump.pop(KEY)
46
+ flag_modified(job_v1, "input_dataset_dump")
47
+ flag_modified(job_v1, "output_dataset_dump")
48
+ db.add(job_v1)
49
+ db.commit()
50
+ db.refresh(job_v1)
51
+ db.expunge(job_v1)
52
+ logger.warning(
53
+ f"Now validating applyworkflow.id={job_v1.id} with "
54
+ "ApplyWorkflowReadV1."
55
+ )
56
+ ApplyWorkflowReadV1(**job_v1.model_dump())
57
+
58
+ # V2 jobs
59
+ stm = select(JobV2)
60
+ jobs_v2 = db.execute(stm).scalars().all()
61
+ for job_v2 in sorted(jobs_v2, key=lambda x: x.id):
62
+ for KEY in ["history", "images"]:
63
+ logger.warning(
64
+ f"Now removing {KEY} from `dataset_dump`, "
65
+ f"for jobv2.id={job_v2.id}."
66
+ )
67
+ if KEY in job_v2.dataset_dump.keys():
68
+ job_v2.dataset_dump.pop(KEY)
69
+ flag_modified(job_v2, "dataset_dump")
70
+ db.add(job_v2)
71
+ db.commit()
72
+ db.refresh(job_v2)
73
+ db.expunge(job_v2)
74
+ logger.warning(
75
+ f"Now validating jobv2.id={job_v2.id} with JobReadV2."
76
+ )
77
+ JobReadV2(**job_v2.model_dump())
78
+
79
+ logger.warning("END of execution of fix_db function")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fractal-server
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: Server component of the Fractal analytics platform
5
5
  Home-page: https://github.com/fractal-analytics-platform/fractal-server
6
6
  License: BSD-3-Clause
@@ -39,7 +39,7 @@ Description-Content-Type: text/markdown
39
39
  # Fractal Server
40
40
 
41
41
  [![PyPI version](https://img.shields.io/pypi/v/fractal-server?color=gree)](https://pypi.org/project/fractal-server/)
42
- [![CI Status](https://github.com/fractal-analytics-platform/fractal-server/actions/workflows/ci.yml/badge.svg)](https://github.com/fractal-analytics-platform/fractal-server/actions/workflows/ci.yml)
42
+ [![CI Status](https://github.com/fractal-analytics-platform/fractal-server/actions/workflows/ci.yml/badge.svg)](https://github.com/fractal-analytics-platform/fractal-server/actions/workflows/ci.yml?query=branch%3Amain)
43
43
  [![Coverage](https://raw.githubusercontent.com/fractal-analytics-platform/fractal-server/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/fractal-analytics-platform/fractal-server/blob/python-coverage-comment-action-data/htmlcov/index.html)
44
44
  [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
45
45
  [![Benchmarks](https://img.shields.io/badge/Benchmarks-Done-blue)](https://htmlpreview.github.io/?https://github.com/fractal-analytics-platform/fractal-server/blob/benchmark-api/benchmarks/bench.html)
@@ -1,4 +1,4 @@
1
- fractal_server/__init__.py,sha256=gs_vt2BGew5iMLZDjM9dN_UiSCo9swvJzExXe0z6N7w,22
1
+ fractal_server/__init__.py,sha256=dHp8YqTkoz9qO-fmbD43kqbzj_u4UgsCauJnWEM4z0k,22
2
2
  fractal_server/__main__.py,sha256=CocbzZooX1UtGqPi55GcHGNxnrJXFg5tUU5b3wyFCyo,4958
3
3
  fractal_server/alembic.ini,sha256=MWwi7GzjzawI9cCAK1LW7NxIBQDUqD12-ptJoq5JpP0,3153
4
4
  fractal_server/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -64,7 +64,7 @@ fractal_server/app/runner/executors/slurm/_check_jobs_status.py,sha256=8d29a7DQ2
64
64
  fractal_server/app/runner/executors/slurm/_executor_wait_thread.py,sha256=J3tjAx33nBgW4eHAXDte7hDs7Oe9FLEZaElEt8inrbg,4421
65
65
  fractal_server/app/runner/executors/slurm/_slurm_config.py,sha256=rF37XDImX1QoWx37MC5hSM9AuY_KfHU5gaWwN4vl4Zk,15552
66
66
  fractal_server/app/runner/executors/slurm/_subprocess_run_as_user.py,sha256=8CCtxWCuB5UDst3C_WJxBU77xwPrpDyq7iMCZMnodXU,5123
67
- fractal_server/app/runner/executors/slurm/executor.py,sha256=O9h6ZPAKM95BUJrZkHCdFJZrw2zR2XmxeB5fCoGp97w,44451
67
+ fractal_server/app/runner/executors/slurm/executor.py,sha256=267YTDvyeA0yX2n2HffxP8OAu_CQF5uB9K-_AaUG3iU,44655
68
68
  fractal_server/app/runner/executors/slurm/remote.py,sha256=wLziIsGdSMiO-jIXM8x77JRK82g_2hx0iBKTiMghuIo,5852
69
69
  fractal_server/app/runner/filenames.py,sha256=9lwu3yB4C67yiijYw8XIKaLFn3mJUt6_TCyVFM_aZUQ,206
70
70
  fractal_server/app/runner/set_start_and_last_task_index.py,sha256=-q4zVybAj8ek2XlbENKlfOAJ39hT_zoJoZkqzDqiAMY,1254
@@ -121,7 +121,8 @@ fractal_server/app/schemas/v2/task_collection.py,sha256=sY29NQfJrbjiidmVkVjSIH-2
121
121
  fractal_server/app/schemas/v2/workflow.py,sha256=Zzx3e-qgkH8le0FUmAx9UrV5PWd7bj14PPXUh_zgZXM,1827
122
122
  fractal_server/app/schemas/v2/workflowtask.py,sha256=atVuVN4aXsVEOmSd-vyg-8_8OnPmqx-gT75rXcn_AlQ,6552
123
123
  fractal_server/app/security/__init__.py,sha256=wxosoHc3mJYPCdPMyWnRD8w_2OgnKYp2aDkdmwrZh5k,11203
124
- fractal_server/config.py,sha256=2vw5M78aAogELsWut9X5sxxUz2lirNFpgqP6OynmKOQ,14859
124
+ fractal_server/config.py,sha256=lXofyyyMdRQoK39yTBUwVotRT8ptSb5LceHlZrUuK2o,15048
125
+ fractal_server/data_migrations/2_0_3.py,sha256=7EhwLCZTk1yHD_dlU-HIf2uvx6jUIgfDaA5np27QEEM,2918
125
126
  fractal_server/data_migrations/README.md,sha256=_3AEFvDg9YkybDqCLlFPdDmGJvr6Tw7HRI14aZ3LOIw,398
126
127
  fractal_server/images/__init__.py,sha256=xO6jTLE4EZKO6cTDdJsBmK9cdeh9hFTaSbSuWgQg7y4,196
127
128
  fractal_server/images/models.py,sha256=9ipU5h4N6ogBChoB-2vHoqtL0TXOHCv6kRR-fER3mkM,4167
@@ -162,8 +163,8 @@ fractal_server/tasks/v2/background_operations.py,sha256=MAMBn6W2bhkdK59kfUGiD7a1
162
163
  fractal_server/tasks/v2/get_collection_data.py,sha256=Qhf2T_aaqAfqu9_KpUSlXsS7EJoZQbEPEreHHa2jco8,502
163
164
  fractal_server/urls.py,sha256=5o_qq7PzKKbwq12NHSQZDmDitn5RAOeQ4xufu-2v9Zk,448
164
165
  fractal_server/utils.py,sha256=b7WwFdcFZ8unyT65mloFToYuEDXpQoHRcmRNqrhd_dQ,2115
165
- fractal_server-2.0.2.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
166
- fractal_server-2.0.2.dist-info/METADATA,sha256=ykUREKoZndksb0goOo27hM14j41SvTljFa5P7eR9zTU,4202
167
- fractal_server-2.0.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
168
- fractal_server-2.0.2.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
169
- fractal_server-2.0.2.dist-info/RECORD,,
166
+ fractal_server-2.0.4.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
167
+ fractal_server-2.0.4.dist-info/METADATA,sha256=4irspCdC-GXbBTPYtUiQ8FIAaFeRfJBlYnuGWYGdKBo,4222
168
+ fractal_server-2.0.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
169
+ fractal_server-2.0.4.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
170
+ fractal_server-2.0.4.dist-info/RECORD,,