fractal-server 2.15.0a1__py3-none-any.whl → 2.15.0a3__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.0a3"
@@ -57,7 +57,9 @@ def collect_local_pixi(
57
57
  return
58
58
 
59
59
  logger.info("START")
60
- for key, value in task_group.model_dump().items():
60
+ for key, value in task_group.model_dump(
61
+ exclude={"env_info"}
62
+ ).items():
61
63
  logger.debug(f"task_group.{key}: {value}")
62
64
 
63
65
  if Path(task_group.path).exists():
@@ -73,9 +75,6 @@ def collect_local_pixi(
73
75
  )
74
76
  return
75
77
 
76
- # Set `pixi_home`
77
- pixi_home = settings.pixi.versions[task_group.pixi_version]
78
-
79
78
  try:
80
79
  Path(task_group.path).mkdir(parents=True)
81
80
  logger.info(f"Created {task_group.path}")
@@ -90,7 +89,10 @@ def collect_local_pixi(
90
89
 
91
90
  common_args = dict(
92
91
  replacements={
93
- ("__PIXI_HOME__", pixi_home),
92
+ (
93
+ "__PIXI_HOME__",
94
+ settings.pixi.versions[task_group.pixi_version],
95
+ ),
94
96
  ("__PACKAGE_DIR__", task_group.path),
95
97
  ("__TAR_GZ_PATH__", archive_path),
96
98
  (
@@ -52,7 +52,9 @@ def deactivate_local_pixi(
52
52
  # Log some info
53
53
  logger.debug("START")
54
54
 
55
- for key, value in task_group.model_dump().items():
55
+ for key, value in task_group.model_dump(
56
+ exclude={"env_info"}
57
+ ).items():
56
58
  logger.debug(f"task_group.{key}: {value}")
57
59
 
58
60
  source_dir = Path(task_group.path, SOURCE_DIR_NAME)
@@ -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
 
@@ -55,7 +57,9 @@ def reactivate_local_pixi(
55
57
  # Log some info
56
58
  logger.debug("START")
57
59
 
58
- for key, value in task_group.model_dump().items():
60
+ for key, value in task_group.model_dump(
61
+ exclude={"env_info"}
62
+ ).items():
59
63
  logger.debug(f"task_group.{key}: {value}")
60
64
 
61
65
  source_dir = Path(task_group.path, SOURCE_DIR_NAME).as_posix()
@@ -76,42 +80,61 @@ def reactivate_local_pixi(
76
80
  activity.status = TaskGroupActivityStatusV2.ONGOING
77
81
  activity = add_commit_refresh(obj=activity, db=db)
78
82
 
79
- logger.debug("start - writing pixi lock")
80
- with open(f"{task_group.path}/pixi.lock", "w") as f:
81
- f.write(task_group.env_info)
82
- logger.debug("end - writing pixi lock")
83
-
84
- subprocess.run( # nosec
85
- shlex.split(
86
- f"tar xz -f {task_group.archive_path} "
87
- f"{Path(task_group.archive_path).name}"
83
+ settings = Inject(get_settings)
84
+ common_args = dict(
85
+ replacements={
86
+ (
87
+ "__PIXI_HOME__",
88
+ settings.pixi.versions[task_group.pixi_version],
89
+ ),
90
+ ("__PACKAGE_DIR__", task_group.path),
91
+ ("__TAR_GZ_PATH__", task_group.archive_path),
92
+ (
93
+ "__IMPORT_PACKAGE_NAME__",
94
+ task_group.pkg_name.replace("-", "_"),
95
+ ),
96
+ ("__SOURCE_DIR_NAME__", SOURCE_DIR_NAME),
97
+ ("__FROZEN_OPTION__", "true"),
98
+ },
99
+ script_dir=Path(
100
+ task_group.path, SCRIPTS_SUBFOLDER
101
+ ).as_posix(),
102
+ prefix=(
103
+ f"{int(time.time())}_"
104
+ f"{TaskGroupActivityActionV2.REACTIVATE}"
88
105
  ),
89
- encoding="utf-8",
90
- cwd=task_group.path,
106
+ logger_name=LOGGER_NAME,
91
107
  )
92
108
 
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,
109
+ # Run script 1 - extract tar.gz into `source_dir`
110
+ _customize_and_run_template(
111
+ template_filename="pixi_1_extract.sh",
112
+ **common_args,
99
113
  )
114
+ activity.log = get_current_log(log_file_path)
115
+ activity = add_commit_refresh(obj=activity, db=db)
100
116
 
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,
117
+ # Write pixi.lock into `source_dir`
118
+ logger.debug(f"start - writing {source_dir}/pixi.lock")
119
+ with Path(source_dir, "pixi.lock").open("w") as f:
120
+ f.write(task_group.env_info)
121
+ logger.debug(f"end - writing {source_dir}/pixi.lock")
122
+
123
+ # Run script 2 - run pixi-install command
124
+ _customize_and_run_template(
125
+ template_filename="pixi_2_install.sh",
126
+ **common_args,
127
+ )
128
+ activity.log = get_current_log(log_file_path)
129
+ activity = add_commit_refresh(obj=activity, db=db)
130
+
131
+ # Run script 3
132
+ _customize_and_run_template(
133
+ template_filename="pixi_3_post_install.sh",
134
+ **common_args,
113
135
  )
114
- logger.debug("end - pixi install")
136
+ activity.log = get_current_log(log_file_path)
137
+ activity = add_commit_refresh(obj=activity, db=db)
115
138
 
116
139
  activity.log = get_current_log(log_file_path)
117
140
  activity.status = TaskGroupActivityStatusV2.OK
@@ -80,7 +80,9 @@ def collect_ssh_pixi(
80
80
 
81
81
  # Log some info
82
82
  logger.info("START")
83
- for key, value in task_group.model_dump().items():
83
+ for key, value in task_group.model_dump(
84
+ exclude={"env_info"}
85
+ ).items():
84
86
  logger.debug(f"task_group.{key}: {value}")
85
87
 
86
88
  # Check that SSH connection works
@@ -130,9 +132,7 @@ def collect_ssh_pixi(
130
132
  archive_path = (
131
133
  Path(task_group.path) / tar_gz_filename
132
134
  ).as_posix()
133
- tmp_archive_path = (
134
- Path(tmpdir) / tar_gz_filename
135
- ).as_posix()
135
+ tmp_archive_path = Path(tmpdir, tar_gz_filename).as_posix()
136
136
  logger.info(
137
137
  f"Write tar.gz-file contents into {tmp_archive_path}"
138
138
  )
@@ -176,8 +176,8 @@ def collect_ssh_pixi(
176
176
  f"{int(time.time())}_"
177
177
  f"{TaskGroupActivityActionV2.COLLECT}"
178
178
  ),
179
- fractal_ssh=fractal_ssh,
180
179
  logger_name=LOGGER_NAME,
180
+ fractal_ssh=fractal_ssh,
181
181
  )
182
182
 
183
183
  # Run the three pixi-related scripts
@@ -62,7 +62,9 @@ def deactivate_ssh_pixi(
62
62
 
63
63
  # Log some info
64
64
  logger.debug("START")
65
- for key, value in task_group.model_dump().items():
65
+ for key, value in task_group.model_dump(
66
+ exclude={"env_info"}
67
+ ).items():
66
68
  logger.debug(f"task_group.{key}: {value}")
67
69
 
68
70
  # Check that SSH connection works
@@ -58,7 +58,9 @@ def reactivate_ssh_pixi(
58
58
 
59
59
  # Log some info
60
60
  logger.info("START")
61
- for key, value in task_group.model_dump().items():
61
+ for key, value in task_group.model_dump(
62
+ exclude={"env_info"}
63
+ ).items():
62
64
  logger.debug(f"task_group.{key}: {value}")
63
65
 
64
66
  # Check that SSH connection works
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: fractal-server
3
- Version: 2.15.0a1
3
+ Version: 2.15.0a3
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=tcBKTFic3HqyDYYBuQ8rt1m1EBOL362w1jDviQBo4aI,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,19 +193,19 @@ 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=hm-57SixLujb6wGUI2RBOv49g3E14j80BxGpxhW5x50,9915
197
197
  fractal_server/tasks/v2/local/deactivate.py,sha256=jaJ-Ejq29JQTZpiQjWHCRf2yUPZUbnjvaQrqnNkmFuo,9836
198
- fractal_server/tasks/v2/local/deactivate_pixi.py,sha256=S3ipLVwpzkpGpSKVsDBdiv3RBt0DsVL_sGux3I5aSg8,3597
198
+ fractal_server/tasks/v2/local/deactivate_pixi.py,sha256=JM5YM8HLd6YoJdkUH8k8WhXjpydfB3EIhbrL-6SdZgU,3647
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=wAUpGWS8mbWn78T2Eh-b6fRDAIIh_d60DUNsFAwN69I,6542
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
204
- fractal_server/tasks/v2/ssh/collect_pixi.py,sha256=C1hJE8GcROLFfPOT2YnmCDfCvO8jtaSsUzWlvxvSCQc,13273
204
+ fractal_server/tasks/v2/ssh/collect_pixi.py,sha256=uzDVM3zN3m6U3uekH2qKjxQyeFOi9l_ZU5e-iExJCiw,13282
205
205
  fractal_server/tasks/v2/ssh/deactivate.py,sha256=A4v9pcualcGD7l-eWcnMbM0N0HEsectHFA9lJnDXlM0,12639
206
- fractal_server/tasks/v2/ssh/deactivate_pixi.py,sha256=qksD9ccpjy0v8ckhbZUfcuFVJf5iL25nj6wHNqvDkUg,4947
206
+ fractal_server/tasks/v2/ssh/deactivate_pixi.py,sha256=18S9CQ7XA1YS4GHHFl-1HzHRtKnI2TNDSxvuFeA1HhM,5005
207
207
  fractal_server/tasks/v2/ssh/reactivate.py,sha256=IWekB37oCWzqiFvHe2ncsvL1qgM9RVCmqe3CMBaz5L8,8472
208
- fractal_server/tasks/v2/ssh/reactivate_pixi.py,sha256=khOJuLon3l_Vj6whJWkcw7w0rnUsp6cq2fIdTTsZuFY,3789
208
+ fractal_server/tasks/v2/ssh/reactivate_pixi.py,sha256=Szs4yuDOp2kib1Sda7AFQsHtVQLJstGhtFSUjT9hZrs,3847
209
209
  fractal_server/tasks/v2/templates/1_create_venv.sh,sha256=PK0jdHKtQpda1zULebBaVPORt4t6V17wa4N1ohcj5ac,548
210
210
  fractal_server/tasks/v2/templates/2_pip_install.sh,sha256=jMJPQJXHKznO6fxOOXtFXKPdCmTf1VLLWj_JL_ZdKxo,1644
211
211
  fractal_server/tasks/v2/templates/3_pip_freeze.sh,sha256=JldREScEBI4cD_qjfX4UK7V4aI-FnX9ZvVNxgpSOBFc,168
@@ -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.0a3.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
233
+ fractal_server-2.15.0a3.dist-info/METADATA,sha256=Ohmn8BKN9-iTrWF56LJDlUnfC7ZBCi_Y4jX6j0IwAt8,4245
234
+ fractal_server-2.15.0a3.dist-info/WHEEL,sha256=7dDg4QLnNKTvwIDR9Ac8jJaAmBC_owJrckbC0jjThyA,88
235
+ fractal_server-2.15.0a3.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
236
+ fractal_server-2.15.0a3.dist-info/RECORD,,