fractal-server 2.15.0a1__py3-none-any.whl → 2.15.0a2__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.15.0a1"
1
+ __VERSION__ = "2.15.0a2"
@@ -73,9 +73,6 @@ def collect_local_pixi(
73
73
  )
74
74
  return
75
75
 
76
- # Set `pixi_home`
77
- pixi_home = settings.pixi.versions[task_group.pixi_version]
78
-
79
76
  try:
80
77
  Path(task_group.path).mkdir(parents=True)
81
78
  logger.info(f"Created {task_group.path}")
@@ -90,7 +87,10 @@ def collect_local_pixi(
90
87
 
91
88
  common_args = dict(
92
89
  replacements={
93
- ("__PIXI_HOME__", pixi_home),
90
+ (
91
+ "__PIXI_HOME__",
92
+ settings.pixi.versions[task_group.pixi_version],
93
+ ),
94
94
  ("__PACKAGE_DIR__", task_group.path),
95
95
  ("__TAR_GZ_PATH__", archive_path),
96
96
  (
@@ -1,6 +1,5 @@
1
- import shlex
2
1
  import shutil
3
- import subprocess # nosec
2
+ import time
4
3
  from pathlib import Path
5
4
  from tempfile import TemporaryDirectory
6
5
 
@@ -9,13 +8,16 @@ from ..utils_background import fail_and_cleanup
9
8
  from ..utils_background import get_activity_and_task_group
10
9
  from ..utils_pixi import SOURCE_DIR_NAME
11
10
  from fractal_server.app.db import get_sync_db
11
+ from fractal_server.app.schemas.v2 import TaskGroupActivityActionV2
12
12
  from fractal_server.app.schemas.v2.task_group import TaskGroupActivityStatusV2
13
13
  from fractal_server.config import get_settings
14
14
  from fractal_server.logger import reset_logger_handlers
15
15
  from fractal_server.logger import set_logger
16
16
  from fractal_server.syringe import Inject
17
17
  from fractal_server.tasks.utils import get_log_path
18
+ from fractal_server.tasks.v2.local._utils import _customize_and_run_template
18
19
  from fractal_server.tasks.v2.utils_background import get_current_log
20
+ from fractal_server.tasks.v2.utils_templates import SCRIPTS_SUBFOLDER
19
21
  from fractal_server.utils import get_timestamp
20
22
 
21
23
 
@@ -76,42 +78,60 @@ def reactivate_local_pixi(
76
78
  activity.status = TaskGroupActivityStatusV2.ONGOING
77
79
  activity = add_commit_refresh(obj=activity, db=db)
78
80
 
79
- logger.debug("start - writing pixi lock")
80
- with open(f"{task_group.path}/pixi.lock", "w") as f:
81
+ logger.debug(f"start - writing {source_dir}/pixi.lock")
82
+ with Path(source_dir, "pixi.lock").open("w") as f:
81
83
  f.write(task_group.env_info)
82
- logger.debug("end - writing pixi lock")
84
+ logger.debug(f"end - writing {source_dir}/pixi.lock")
83
85
 
84
- subprocess.run( # nosec
85
- shlex.split(
86
- f"tar xz -f {task_group.archive_path} "
87
- f"{Path(task_group.archive_path).name}"
86
+ settings = Inject(get_settings)
87
+ common_args = dict(
88
+ replacements={
89
+ (
90
+ "__PIXI_HOME__",
91
+ settings.pixi.versions[task_group.pixi_version],
92
+ ),
93
+ ("__PACKAGE_DIR__", task_group.path),
94
+ ("__TAR_GZ_PATH__", task_group.archive_path),
95
+ (
96
+ "__IMPORT_PACKAGE_NAME__",
97
+ task_group.pkg_name.replace("-", "_"),
98
+ ),
99
+ ("__SOURCE_DIR_NAME__", SOURCE_DIR_NAME),
100
+ ("__FROZEN_OPTION__", "true"),
101
+ },
102
+ script_dir=Path(
103
+ task_group.path, SCRIPTS_SUBFOLDER
104
+ ).as_posix(),
105
+ prefix=(
106
+ f"{int(time.time())}_"
107
+ f"{TaskGroupActivityActionV2.REACTIVATE}"
88
108
  ),
89
- encoding="utf-8",
90
- cwd=task_group.path,
109
+ logger_name=LOGGER_NAME,
91
110
  )
92
111
 
93
- subprocess.run( # nosec
94
- shlex.split(
95
- f"mv {Path(task_group.archive_path).name} {source_dir}"
96
- ),
97
- encoding="utf-8",
98
- cwd=task_group.path,
112
+ # Run script 1
113
+ _customize_and_run_template(
114
+ template_filename="pixi_1_extract.sh",
115
+ **common_args,
99
116
  )
117
+ activity.log = get_current_log(log_file_path)
118
+ activity = add_commit_refresh(obj=activity, db=db)
100
119
 
101
- settings = Inject(get_settings)
102
- pixi_home = settings.pixi.versions[task_group.pixi_version]
103
- pixi_bin = Path(pixi_home, "bin/pixi").as_posix()
104
-
105
- logger.debug("start - pixi install")
106
- subprocess.run( # nosec
107
- shlex.split(
108
- f"{pixi_bin} install "
109
- f"--manifest-path {source_dir}/pyproject.toml --frozen"
110
- ),
111
- encoding="utf-8",
112
- cwd=task_group.path,
120
+ # Run script 2
121
+ _customize_and_run_template(
122
+ template_filename="pixi_2_install.sh",
123
+ **common_args,
113
124
  )
114
- logger.debug("end - pixi install")
125
+ activity.log = get_current_log(log_file_path)
126
+ activity = add_commit_refresh(obj=activity, db=db)
127
+
128
+ # Run script 3
129
+ _customize_and_run_template(
130
+ template_filename="pixi_3_post_install.sh",
131
+ **common_args,
132
+ )
133
+ activity.log = get_current_log(log_file_path)
134
+ activity = add_commit_refresh(obj=activity, db=db)
115
135
 
116
136
  activity.log = get_current_log(log_file_path)
117
137
  activity.status = TaskGroupActivityStatusV2.OK
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: fractal-server
3
- Version: 2.15.0a1
3
+ Version: 2.15.0a2
4
4
  Summary: Backend component of the Fractal analytics platform
5
5
  License: BSD-3-Clause
6
6
  Author: Tommaso Comparin
@@ -1,4 +1,4 @@
1
- fractal_server/__init__.py,sha256=jqf_k5MzFRozDqpvzsTxEimwRfYyqB0UiYf2p5oD-pw,25
1
+ fractal_server/__init__.py,sha256=p2CNc7pXWHJeIFFY2UyN5qnuVf1-pAw9mr2D7XjIBDI,25
2
2
  fractal_server/__main__.py,sha256=rkM8xjY1KeS3l63irB8yCrlVobR-73uDapC4wvrIlxI,6957
3
3
  fractal_server/alembic.ini,sha256=MWwi7GzjzawI9cCAK1LW7NxIBQDUqD12-ptJoq5JpP0,3153
4
4
  fractal_server/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -193,11 +193,11 @@ fractal_server/tasks/v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
193
193
  fractal_server/tasks/v2/local/__init__.py,sha256=S842wRersYKBKjc7xbmj0ov8b5i1YuCHa2f_yYuxcaI,312
194
194
  fractal_server/tasks/v2/local/_utils.py,sha256=n-w1IqgOTeeXLE0LoHBixrU7kkg-eYEPWepur6g7DQA,2664
195
195
  fractal_server/tasks/v2/local/collect.py,sha256=OIqvvXqI631MjHDGxYj3a7AmC0FhMZ2v2LD3RSZ18wU,12000
196
- fractal_server/tasks/v2/local/collect_pixi.py,sha256=0vHDSq34VMFExz_TX7hwd0WrXilIEvfHtrs107zjX9U,9847
196
+ fractal_server/tasks/v2/local/collect_pixi.py,sha256=MAr48JqTbBIw72i2HC9NxgLjdu2Z76B_YlcOaiEb_UA,9865
197
197
  fractal_server/tasks/v2/local/deactivate.py,sha256=jaJ-Ejq29JQTZpiQjWHCRf2yUPZUbnjvaQrqnNkmFuo,9836
198
198
  fractal_server/tasks/v2/local/deactivate_pixi.py,sha256=S3ipLVwpzkpGpSKVsDBdiv3RBt0DsVL_sGux3I5aSg8,3597
199
199
  fractal_server/tasks/v2/local/reactivate.py,sha256=ZZhwyoQQ8Lzkk18BB4l3pr8x8VI-MnZSoClKnMvTy14,5860
200
- fractal_server/tasks/v2/local/reactivate_pixi.py,sha256=MRixXYbQPq3Cc47r0bBQc-4Spj8B1dgqn1uuQKrlPQA,5317
200
+ fractal_server/tasks/v2/local/reactivate_pixi.py,sha256=T7Rviv-vifg3D1UxHf4aIc-6hG1HdZ4phEyYEZVX7vo,6378
201
201
  fractal_server/tasks/v2/ssh/__init__.py,sha256=vX5aIM9Hbn2T_cIP_LrZ5ekRqJzYm_GSfp-4Iv7kqeI,300
202
202
  fractal_server/tasks/v2/ssh/_utils.py,sha256=VAagoseIQW_fSsbwLencqQGyPflQii-Tvzk-r58g478,2834
203
203
  fractal_server/tasks/v2/ssh/collect.py,sha256=4PwHLEBjY6CV0URHfin47YXPQnhcoizBug2-Syh1CKQ,14543
@@ -229,8 +229,8 @@ fractal_server/types/validators/_workflow_task_arguments_validators.py,sha256=HL
229
229
  fractal_server/urls.py,sha256=QjIKAC1a46bCdiPMu3AlpgFbcv6a4l3ABcd5xz190Og,471
230
230
  fractal_server/utils.py,sha256=Vn35lApt1T1J8nc09sAVqd10Cy0sa3dLipcljI-hkuk,2185
231
231
  fractal_server/zip_tools.py,sha256=tqz_8f-vQ9OBRW-4OQfO6xxY-YInHTyHmZxU7U4PqZo,4885
232
- fractal_server-2.15.0a1.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
233
- fractal_server-2.15.0a1.dist-info/METADATA,sha256=BjMlnSvVc1DYozWmqOI19lWcVATlbEG_ELwzyvo4Hlc,4245
234
- fractal_server-2.15.0a1.dist-info/WHEEL,sha256=7dDg4QLnNKTvwIDR9Ac8jJaAmBC_owJrckbC0jjThyA,88
235
- fractal_server-2.15.0a1.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
236
- fractal_server-2.15.0a1.dist-info/RECORD,,
232
+ fractal_server-2.15.0a2.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
233
+ fractal_server-2.15.0a2.dist-info/METADATA,sha256=pPjPz3h14JS4StI6QZVCA4LU_9Yib5fDpINeID1PMv0,4245
234
+ fractal_server-2.15.0a2.dist-info/WHEEL,sha256=7dDg4QLnNKTvwIDR9Ac8jJaAmBC_owJrckbC0jjThyA,88
235
+ fractal_server-2.15.0a2.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
236
+ fractal_server-2.15.0a2.dist-info/RECORD,,