fractal-server 2.3.2__py3-none-any.whl → 2.3.3__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.3.2"
1
+ __VERSION__ = "2.3.3"
fractal_server/config.py CHANGED
@@ -497,7 +497,7 @@ class Settings(BaseSettings):
497
497
  [`clusterfutures`](https://github.com/sampsyo/clusterfutures/blob/master/cfut/__init__.py)).
498
498
  """
499
499
 
500
- FRACTAL_SLURM_SBATCH_SLEEP: int = 0
500
+ FRACTAL_SLURM_SBATCH_SLEEP: float = 0
501
501
  """
502
502
  Interval to wait (in seconds) between two subsequent `sbatch` calls, when
503
503
  running a task that produces multiple SLURM jobs.
@@ -286,7 +286,6 @@ class FractalSSH(object):
286
286
  folder: Absolute path to a folder that should be removed.
287
287
  safe_root: If `folder` is not a subfolder of the absolute
288
288
  `safe_root` path, raise an error.
289
- fractal_ssh:
290
289
  """
291
290
  invalid_characters = {" ", "\n", ";", "$", "`"}
292
291
 
@@ -9,12 +9,12 @@ def sanitize_string(value: str) -> str:
9
9
 
10
10
  Make the string lower-case, and replace any special character with an
11
11
  underscore, where special characters are:
12
- ```python repl
13
- >>> string.punctuation
14
- '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
15
- >>> string.whitespace
16
- ' \t\n\r\x0b\x0c'
17
- ```
12
+
13
+
14
+ >>> string.punctuation
15
+ '!"#$%&\'()*+,-./:;<=>?@[\\\\]^_`{|}~'
16
+ >>> string.whitespace
17
+ ' \\t\\n\\r\\x0b\\x0c'
18
18
 
19
19
  Args:
20
20
  value: Input string
@@ -35,5 +35,11 @@ def slugify_task_name_for_source(task_name: str) -> str:
35
35
  from `fractal_server.string_tools.sanitize_string`, nor we can remove it.
36
36
  As 2.3.1, we are renaming it to `slugify_task_name_for_source`, to make
37
37
  it clear that it should not be used for other purposes.
38
+
39
+ Args:
40
+ task_name:
41
+
42
+ Return:
43
+ Slug-ified task name.
38
44
  """
39
45
  return task_name.replace(" ", "_").lower()
@@ -167,7 +167,7 @@ def background_collect_pip_ssh(
167
167
  / ".fractal"
168
168
  / f"{task_pkg.package_name}{package_version}"
169
169
  ).as_posix()
170
-
170
+ logger.debug(f"{package_env_dir=}")
171
171
  replacements = [
172
172
  ("__PACKAGE_NAME__", task_pkg.package_name),
173
173
  ("__PACKAGE_ENV_DIR__", package_env_dir),
@@ -197,10 +197,18 @@ def background_collect_pip_ssh(
197
197
  # long operations that do not use the db
198
198
  db.close()
199
199
 
200
+ # `remove_venv_folder_upon_failure` is set to True only if
201
+ # script 1 goes through, which means that the remote folder
202
+ # `package_env_dir` did not already exist. If this remote
203
+ # folder already existed, then script 1 fails and the boolean
204
+ # flag `remove_venv_folder_upon_failure` remains false.
205
+ remove_venv_folder_upon_failure = False
200
206
  stdout = _customize_and_run_template(
201
207
  script_filename="_1_create_venv.sh",
202
208
  **common_args,
203
209
  )
210
+ remove_venv_folder_upon_failure = True
211
+
204
212
  stdout = _customize_and_run_template(
205
213
  script_filename="_2_upgrade_pip.sh",
206
214
  **common_args,
@@ -294,6 +302,7 @@ def background_collect_pip_ssh(
294
302
 
295
303
  # Finalize (write metadata to DB)
296
304
  logger.debug("finalising - START")
305
+
297
306
  collection_state = db.get(CollectionStateV2, state_id)
298
307
  collection_state.data["log"] = log_file_path.open("r").read()
299
308
  collection_state.data["freeze"] = stdout_pip_freeze
@@ -312,16 +321,26 @@ def background_collect_pip_ssh(
312
321
  exception=e,
313
322
  db=db,
314
323
  )
315
- try:
316
- logger.info(f"Now delete remote folder {package_env_dir}")
317
- fractal_ssh.remove_folder(
318
- folder=package_env_dir,
319
- safe_root=settings.FRACTAL_SLURM_SSH_WORKING_BASE_DIR,
320
- )
321
- logger.info(f"Deleted remoted folder {package_env_dir}")
322
- except Exception as e:
323
- logger.error(
324
- f"Deleting remote folder failed.\n"
325
- f"Original error:\n{str(e)}"
326
- )
324
+ if remove_venv_folder_upon_failure:
325
+ try:
326
+ logger.info(
327
+ f"Now delete remote folder {package_env_dir}"
328
+ )
329
+ fractal_ssh.remove_folder(
330
+ folder=package_env_dir,
331
+ safe_root=settings.FRACTAL_SLURM_SSH_WORKING_BASE_DIR, # noqa: E501
332
+ )
333
+ logger.info(
334
+ f"Deleted remoted folder {package_env_dir}"
335
+ )
336
+ except Exception as e:
337
+ logger.error(
338
+ f"Removing remote folder failed.\n"
339
+ f"Original error:\n{str(e)}"
340
+ )
341
+ else:
342
+ logger.info(
343
+ "Not trying to remove remote folder "
344
+ f"{package_env_dir}."
345
+ )
327
346
  return
@@ -12,12 +12,12 @@ PYTHON=__PYTHON__
12
12
 
13
13
  TIME_START=$(date +%s)
14
14
 
15
-
16
- # Create main folder
15
+ # Check that package folder does not exist
17
16
  if [ -d "$PACKAGE_ENV_DIR" ]; then
18
17
  write_log "ERROR: Folder $PACKAGE_ENV_DIR already exists. Exit."
19
18
  exit 1
20
19
  fi
20
+
21
21
  write_log "START mkdir -p $PACKAGE_ENV_DIR"
22
22
  mkdir -p $PACKAGE_ENV_DIR
23
23
  write_log "END mkdir -p $PACKAGE_ENV_DIR"
@@ -7,10 +7,6 @@ write_log(){
7
7
 
8
8
  # Variables to be filled within fractal-server
9
9
  PACKAGE_ENV_DIR=__PACKAGE_ENV_DIR__
10
- PACKAGE_NAME=__PACKAGE_NAME__
11
- PACKAGE=__PACKAGE__
12
- PYTHON=__PYTHON__
13
- INSTALL_STRING=__INSTALL_STRING__
14
10
 
15
11
  TIME_START=$(date +%s)
16
12
 
@@ -8,12 +8,8 @@ write_log(){
8
8
 
9
9
  # Variables to be filled within fractal-server
10
10
  PACKAGE_ENV_DIR=__PACKAGE_ENV_DIR__
11
- PACKAGE_NAME=__PACKAGE_NAME__
12
- PACKAGE=__PACKAGE__
13
- PYTHON=__PYTHON__
14
11
  INSTALL_STRING=__INSTALL_STRING__
15
12
 
16
-
17
13
  TIME_START=$(date +%s)
18
14
 
19
15
  VENVPYTHON=${PACKAGE_ENV_DIR}/bin/python
@@ -9,12 +9,6 @@ write_log(){
9
9
 
10
10
  # Variables to be filled within fractal-server
11
11
  PACKAGE_ENV_DIR=__PACKAGE_ENV_DIR__
12
- PACKAGE_NAME=__PACKAGE_NAME__
13
- PACKAGE=__PACKAGE__
14
- PYTHON=__PYTHON__
15
- INSTALL_STRING=__INSTALL_STRING__
16
-
17
-
18
12
 
19
13
  VENVPYTHON=${PACKAGE_ENV_DIR}/bin/python
20
14
 
@@ -9,9 +9,7 @@ write_log(){
9
9
  # Variables to be filled within fractal-server
10
10
  PACKAGE_ENV_DIR=__PACKAGE_ENV_DIR__
11
11
  PACKAGE_NAME=__PACKAGE_NAME__
12
- PACKAGE=__PACKAGE__
13
- PYTHON=__PYTHON__
14
- INSTALL_STRING=__INSTALL_STRING__
12
+
15
13
 
16
14
 
17
15
  TIME_START=$(date +%s)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fractal-server
3
- Version: 2.3.2
3
+ Version: 2.3.3
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
@@ -1,4 +1,4 @@
1
- fractal_server/__init__.py,sha256=rXqFcllf2dozijOCAlnZWvgsFpCEMVhBtm66tw0cp-A,22
1
+ fractal_server/__init__.py,sha256=cbDFprg05SSdPI6GVzVSaFJyKMlLMr-cn7_vn5ISPN4,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
@@ -138,7 +138,7 @@ fractal_server/app/schemas/v2/task_collection.py,sha256=8PG1bOqkfQqORMN0brWf6mHD
138
138
  fractal_server/app/schemas/v2/workflow.py,sha256=Zzx3e-qgkH8le0FUmAx9UrV5PWd7bj14PPXUh_zgZXM,1827
139
139
  fractal_server/app/schemas/v2/workflowtask.py,sha256=atVuVN4aXsVEOmSd-vyg-8_8OnPmqx-gT75rXcn_AlQ,6552
140
140
  fractal_server/app/security/__init__.py,sha256=2-QbwuR-nsuHM_uwKS_WzYvkhnuhO5jUv8UVROetyVk,11169
141
- fractal_server/config.py,sha256=SCKJrGQeKkWxyz-kT7sCjcxwKwidR1bT0hi0KEj0sV0,24282
141
+ fractal_server/config.py,sha256=LoN530DB9Xxey-riV2BNgUcKEDquMrH9ijuRrwl7TMk,24284
142
142
  fractal_server/data_migrations/README.md,sha256=_3AEFvDg9YkybDqCLlFPdDmGJvr6Tw7HRI14aZ3LOIw,398
143
143
  fractal_server/gunicorn_fractal.py,sha256=2AOkgxu-oQ-XB578_voT0VuhmAXFTmb0c-nYn1XLy_Q,1231
144
144
  fractal_server/images/__init__.py,sha256=xO6jTLE4EZKO6cTDdJsBmK9cdeh9hFTaSbSuWgQg7y4,196
@@ -167,8 +167,8 @@ fractal_server/migrations/versions/efa89c30e0a4_add_project_timestamp_created.py
167
167
  fractal_server/migrations/versions/f384e1c0cf5d_drop_task_default_args_columns.py,sha256=9BwqUS9Gf7UW_KjrzHbtViC880qhD452KAytkHWWZyk,746
168
168
  fractal_server/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
169
169
  fractal_server/ssh/__init__.py,sha256=sVUmzxf7_DuXG1xoLQ1_00fo5NPhi2LJipSmU5EAkPs,124
170
- fractal_server/ssh/_fabric.py,sha256=GsiB3wrNfIkDmXr5A3qjkXhUAaRCyAT4VJRHIAbI1gM,10764
171
- fractal_server/string_tools.py,sha256=AwwDb-wtgGQeGdZjZQKgtYCmWbFHGNk_DzaCnYerRAY,1197
170
+ fractal_server/ssh/_fabric.py,sha256=4B6D0F2bWWho1V_xdDDBWYAHno9h_6Smp7_FP2n8jYo,10739
171
+ fractal_server/string_tools.py,sha256=KThgTLn_FHNSuEUGLabryJAP6DaFd7bpi-hF5FgkBjw,1268
172
172
  fractal_server/syringe.py,sha256=3qSMW3YaMKKnLdgnooAINOPxnCOxP7y2jeAQYB21Gdo,2786
173
173
  fractal_server/tasks/__init__.py,sha256=kadmVUoIghl8s190_Tt-8f-WBqMi8u8oU4Pvw39NHE8,23
174
174
  fractal_server/tasks/utils.py,sha256=wucz57I7G0Vd8hvtmvonlryACx9zIVlqfxG5I87MJ80,1820
@@ -182,18 +182,18 @@ fractal_server/tasks/v2/_TaskCollectPip.py,sha256=kWQNMNZ8OEddkYhmhsk3E6ArcaD7qe
182
182
  fractal_server/tasks/v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
183
183
  fractal_server/tasks/v2/_venv_pip.py,sha256=xm4XClWYbhXQRqDxYxM9cP7ZCnx-8b078fuVUL12D2M,6286
184
184
  fractal_server/tasks/v2/background_operations.py,sha256=CQwQon5RKAXrjsN255Okh5dcT0R45axgqoPW3EB-v_Q,11527
185
- fractal_server/tasks/v2/background_operations_ssh.py,sha256=Zjoo3UZQD97INksFkhkTMHYHDltDADs8MbWyAWJtjO8,12926
185
+ fractal_server/tasks/v2/background_operations_ssh.py,sha256=3TJp2NW2CJ9KlghWDEhTQ4HDZxmbrLHjb0OQJI3ALo0,13892
186
186
  fractal_server/tasks/v2/endpoint_operations.py,sha256=gT38pl5TEH6WNWOtg4Itegt2lTJJI6YRa7fEj9Y4x2s,4226
187
- fractal_server/tasks/v2/templates/_1_create_venv.sh,sha256=_Lr1UCWQycqea07YZFICxiwQVz9YZHYS-AaVFjNLUyQ,993
188
- fractal_server/tasks/v2/templates/_2_upgrade_pip.sh,sha256=45CPrRxxNBq1ujDA8m1_LWt6QaN1G29mda_LbW2EjN8,626
189
- fractal_server/tasks/v2/templates/_3_pip_install.sh,sha256=ViAf3KKtk8YnEkrhybPV8ZZdmZJ0g2l4zkoVnmXbAKw,664
190
- fractal_server/tasks/v2/templates/_4_pip_freeze.sh,sha256=SHndmLn5daT_lg6rnhNPMrRiPAIbGUlMUBIDDLniVOg,372
191
- fractal_server/tasks/v2/templates/_5_pip_show.sh,sha256=3onbKZ0PJkkYronP4_tdMBoAe3GqxVQFH-L4dUqSkQY,1825
187
+ fractal_server/tasks/v2/templates/_1_create_venv.sh,sha256=5uW0ETYxl5xiQEXP107zgq8V_-vf3k5NzMMj1hSLjas,1015
188
+ fractal_server/tasks/v2/templates/_2_upgrade_pip.sh,sha256=hVqwgWuNOxr6ck-0FklpcF0o7q-vQXQasYNNaPSxlKM,524
189
+ fractal_server/tasks/v2/templates/_3_pip_install.sh,sha256=T9sabeB9iQzVZpLfuLkKGz9EpfHkUrJHKWO4HNij6yM,595
190
+ fractal_server/tasks/v2/templates/_4_pip_freeze.sh,sha256=6BIOVYBPZmaaOuaDwNirt1iHWjj2oDjViUDvQaL_f6Y,268
191
+ fractal_server/tasks/v2/templates/_5_pip_show.sh,sha256=GrJ19uHYQxANEy9JaeNJZVTquY9c8Ww9eCdnC7eLVr0,1754
192
192
  fractal_server/tasks/v2/utils.py,sha256=JOyCacb6MNvrwfLNTyLwcz8y79J29YuJeJ2MK5kqXRM,1657
193
193
  fractal_server/urls.py,sha256=5o_qq7PzKKbwq12NHSQZDmDitn5RAOeQ4xufu-2v9Zk,448
194
194
  fractal_server/utils.py,sha256=b7WwFdcFZ8unyT65mloFToYuEDXpQoHRcmRNqrhd_dQ,2115
195
- fractal_server-2.3.2.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
196
- fractal_server-2.3.2.dist-info/METADATA,sha256=UMmVY5UM3tc8mAtvtT1dncFUsRJgvSOXY3wSYVGTrjw,4425
197
- fractal_server-2.3.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
198
- fractal_server-2.3.2.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
199
- fractal_server-2.3.2.dist-info/RECORD,,
195
+ fractal_server-2.3.3.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
196
+ fractal_server-2.3.3.dist-info/METADATA,sha256=He-pPtJu3dHSdXV-YYSsjeHbCHIYgMGPohJ67v-qIBQ,4425
197
+ fractal_server-2.3.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
198
+ fractal_server-2.3.3.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
199
+ fractal_server-2.3.3.dist-info/RECORD,,