hpcflow-new2 0.2.0a50__py3-none-any.whl → 0.2.0a52__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.
- hpcflow/_version.py +1 -1
- hpcflow/sdk/__init__.py +1 -1
- hpcflow/sdk/api.py +1 -1
- hpcflow/sdk/app.py +20 -11
- hpcflow/sdk/cli.py +34 -59
- hpcflow/sdk/core/__init__.py +13 -1
- hpcflow/sdk/core/actions.py +235 -126
- hpcflow/sdk/core/command_files.py +32 -24
- hpcflow/sdk/core/element.py +110 -114
- hpcflow/sdk/core/errors.py +57 -0
- hpcflow/sdk/core/loop.py +18 -34
- hpcflow/sdk/core/parameters.py +5 -3
- hpcflow/sdk/core/task.py +135 -131
- hpcflow/sdk/core/task_schema.py +11 -4
- hpcflow/sdk/core/utils.py +110 -2
- hpcflow/sdk/core/workflow.py +964 -676
- hpcflow/sdk/data/template_components/environments.yaml +0 -44
- hpcflow/sdk/data/template_components/task_schemas.yaml +52 -10
- hpcflow/sdk/persistence/__init__.py +21 -33
- hpcflow/sdk/persistence/base.py +1340 -458
- hpcflow/sdk/persistence/json.py +424 -546
- hpcflow/sdk/persistence/pending.py +563 -0
- hpcflow/sdk/persistence/store_resource.py +131 -0
- hpcflow/sdk/persistence/utils.py +57 -0
- hpcflow/sdk/persistence/zarr.py +852 -841
- hpcflow/sdk/submission/jobscript.py +133 -112
- hpcflow/sdk/submission/shells/bash.py +62 -16
- hpcflow/sdk/submission/shells/powershell.py +87 -16
- hpcflow/sdk/submission/submission.py +59 -35
- hpcflow/tests/unit/test_element.py +4 -9
- hpcflow/tests/unit/test_persistence.py +218 -0
- hpcflow/tests/unit/test_task.py +11 -12
- hpcflow/tests/unit/test_utils.py +82 -0
- hpcflow/tests/unit/test_workflow.py +3 -1
- {hpcflow_new2-0.2.0a50.dist-info → hpcflow_new2-0.2.0a52.dist-info}/METADATA +3 -1
- {hpcflow_new2-0.2.0a50.dist-info → hpcflow_new2-0.2.0a52.dist-info}/RECORD +38 -34
- {hpcflow_new2-0.2.0a50.dist-info → hpcflow_new2-0.2.0a52.dist-info}/WHEEL +0 -0
- {hpcflow_new2-0.2.0a50.dist-info → hpcflow_new2-0.2.0a52.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
from getpass import getpass
|
2
|
+
from paramiko.ssh_exception import SSHException
|
3
|
+
|
4
|
+
from hpcflow.sdk.core.errors import WorkflowNotFoundError
|
5
|
+
|
6
|
+
|
7
|
+
def ask_pw_on_auth_exc(f, *args, add_pw_to=None, **kwargs):
|
8
|
+
try:
|
9
|
+
out = f(*args, **kwargs)
|
10
|
+
pw = None
|
11
|
+
|
12
|
+
except SSHException:
|
13
|
+
pw = getpass()
|
14
|
+
|
15
|
+
if not add_pw_to:
|
16
|
+
kwargs["password"] = pw
|
17
|
+
else:
|
18
|
+
kwargs[add_pw_to]["password"] = pw
|
19
|
+
|
20
|
+
out = f(*args, **kwargs)
|
21
|
+
|
22
|
+
if not add_pw_to:
|
23
|
+
del kwargs["password"]
|
24
|
+
else:
|
25
|
+
del kwargs[add_pw_to]["password"]
|
26
|
+
|
27
|
+
return out, pw
|
28
|
+
|
29
|
+
|
30
|
+
def infer_store(path: str, fs) -> str:
|
31
|
+
"""Identify the store type using the path and file system parsed by fsspec.
|
32
|
+
|
33
|
+
Parameters
|
34
|
+
----------
|
35
|
+
fs
|
36
|
+
fsspec file system
|
37
|
+
|
38
|
+
"""
|
39
|
+
# try to identify store type just from the path string:
|
40
|
+
if path.endswith(".zip"):
|
41
|
+
store_fmt = "zip"
|
42
|
+
|
43
|
+
elif path.endswith(".json"):
|
44
|
+
store_fmt = "json-single"
|
45
|
+
|
46
|
+
else:
|
47
|
+
# look at the directory contents:
|
48
|
+
if fs.glob(f"{path}/.zattrs"):
|
49
|
+
store_fmt = "zarr"
|
50
|
+
elif fs.glob(f"{path}/metadata.json"):
|
51
|
+
store_fmt = "json"
|
52
|
+
else:
|
53
|
+
raise WorkflowNotFoundError(
|
54
|
+
f"Cannot infer a store format at path {path!r} with file system {fs!r}."
|
55
|
+
)
|
56
|
+
|
57
|
+
return store_fmt
|