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.
Files changed (38) hide show
  1. hpcflow/_version.py +1 -1
  2. hpcflow/sdk/__init__.py +1 -1
  3. hpcflow/sdk/api.py +1 -1
  4. hpcflow/sdk/app.py +20 -11
  5. hpcflow/sdk/cli.py +34 -59
  6. hpcflow/sdk/core/__init__.py +13 -1
  7. hpcflow/sdk/core/actions.py +235 -126
  8. hpcflow/sdk/core/command_files.py +32 -24
  9. hpcflow/sdk/core/element.py +110 -114
  10. hpcflow/sdk/core/errors.py +57 -0
  11. hpcflow/sdk/core/loop.py +18 -34
  12. hpcflow/sdk/core/parameters.py +5 -3
  13. hpcflow/sdk/core/task.py +135 -131
  14. hpcflow/sdk/core/task_schema.py +11 -4
  15. hpcflow/sdk/core/utils.py +110 -2
  16. hpcflow/sdk/core/workflow.py +964 -676
  17. hpcflow/sdk/data/template_components/environments.yaml +0 -44
  18. hpcflow/sdk/data/template_components/task_schemas.yaml +52 -10
  19. hpcflow/sdk/persistence/__init__.py +21 -33
  20. hpcflow/sdk/persistence/base.py +1340 -458
  21. hpcflow/sdk/persistence/json.py +424 -546
  22. hpcflow/sdk/persistence/pending.py +563 -0
  23. hpcflow/sdk/persistence/store_resource.py +131 -0
  24. hpcflow/sdk/persistence/utils.py +57 -0
  25. hpcflow/sdk/persistence/zarr.py +852 -841
  26. hpcflow/sdk/submission/jobscript.py +133 -112
  27. hpcflow/sdk/submission/shells/bash.py +62 -16
  28. hpcflow/sdk/submission/shells/powershell.py +87 -16
  29. hpcflow/sdk/submission/submission.py +59 -35
  30. hpcflow/tests/unit/test_element.py +4 -9
  31. hpcflow/tests/unit/test_persistence.py +218 -0
  32. hpcflow/tests/unit/test_task.py +11 -12
  33. hpcflow/tests/unit/test_utils.py +82 -0
  34. hpcflow/tests/unit/test_workflow.py +3 -1
  35. {hpcflow_new2-0.2.0a50.dist-info → hpcflow_new2-0.2.0a52.dist-info}/METADATA +3 -1
  36. {hpcflow_new2-0.2.0a50.dist-info → hpcflow_new2-0.2.0a52.dist-info}/RECORD +38 -34
  37. {hpcflow_new2-0.2.0a50.dist-info → hpcflow_new2-0.2.0a52.dist-info}/WHEEL +0 -0
  38. {hpcflow_new2-0.2.0a50.dist-info → hpcflow_new2-0.2.0a52.dist-info}/entry_points.txt +0 -0
@@ -1,45 +1 @@
1
- - name: demo_env_1
2
- executables:
3
- - label: demo
4
- instances:
5
- - command: matflow --config-dir="../" demo-software
6
- num_cores: 1
7
- parallel_mode: null
8
- - label: python
9
- instances:
10
- - command: python
11
- num_cores: 1
12
- parallel_mode: null
13
-
14
1
  - name: null_env
15
-
16
- - name: lammps_parse_env
17
- specifiers:
18
- lammps_version: 1.2
19
- setup: |
20
- conda activate lammps_parse_env
21
- executables:
22
- - label: python
23
- instances:
24
- - command: python
25
- num_cores: 1
26
- parallel_mode: null
27
-
28
- - name: lammps_env
29
- specifiers:
30
- lammps_version: 1.3
31
- gcc_version: 3.0231.321+1
32
- executables:
33
- - label: lammps
34
- instances:
35
- - command: lmp_serial
36
- num_cores: 1
37
- parallel_mode: null
38
-
39
- - name: damask_parse_env
40
- executables:
41
- - label: python
42
- instances:
43
- - command: python
44
- num_cores: 1
45
- parallel_mode: null
@@ -1,4 +1,4 @@
1
- - objective: test_bash_t1
1
+ - objective: test_t1_bash
2
2
  inputs:
3
3
  - parameter: p1
4
4
  outputs:
@@ -12,23 +12,65 @@
12
12
  - command: echo "$((<<parameter:p1>> + 100))"
13
13
  stdout: <<parameter:p2>>
14
14
 
15
- - objective: demo_task_2
15
+ - objective: test_t1_ps
16
16
  inputs:
17
+ - parameter: p1
18
+ outputs:
19
+ - parameter: p2
20
+ actions:
21
+ - environments:
22
+ - scope:
23
+ type: any
24
+ environment: null_env
25
+ commands:
26
+ - command: Write-Output ((<<parameter:p1>> + 100))
27
+ stdout: <<parameter:p2>>
28
+
29
+ - objective: test_t2_bash
30
+ inputs:
31
+ - parameter: p2
32
+ outputs:
17
33
  - parameter: p3
18
- - parameter: orientations
34
+ actions:
35
+ - environments:
36
+ - scope:
37
+ type: any
38
+ environment: null_env
39
+ commands:
40
+ - command: echo "$((<<parameter:p2>> + 100))"
41
+ stdout: <<parameter:p3>>
42
+
43
+ - objective: test_t2_ps
44
+ inputs:
45
+ - parameter: p2
19
46
  outputs:
20
- - parameter: p4
47
+ - parameter: p3
21
48
  actions:
22
49
  - environments:
23
50
  - scope:
24
51
  type: any
25
- environment: demo_env_1
52
+ environment: null_env
26
53
  commands:
27
- - command: >
28
- echo "hello! p3=<<parameter:p3>> orientations=<<parameter:orientations>>"
29
- output_file_parsers:
30
- p4:
31
- from_files: [t1_outfile_1]
54
+ - command: Write-Output ((<<parameter:p2>> + 100))
55
+ stdout: <<parameter:p3>>
56
+
57
+ # - objective: demo_task_2
58
+ # inputs:
59
+ # - parameter: p3
60
+ # - parameter: orientations
61
+ # outputs:
62
+ # - parameter: p4
63
+ # actions:
64
+ # - environments:
65
+ # - scope:
66
+ # type: any
67
+ # environment: demo_env_1
68
+ # commands:
69
+ # - command: >
70
+ # echo "hello! p3=<<parameter:p3>> orientations=<<parameter:orientations>>"
71
+ # output_file_parsers:
72
+ # p4:
73
+ # from_files: [t1_outfile_1]
32
74
 
33
75
  - objective: dummy_task_1
34
76
  inputs:
@@ -1,43 +1,31 @@
1
+ import copy
1
2
  from pathlib import Path
2
3
  import random
3
4
  import string
4
- from typing import Type
5
+ import time
6
+ from typing import Type, Union
5
7
 
6
- from hpcflow.sdk.core.errors import WorkflowNotFoundError
8
+ from reretry import retry
7
9
 
8
- from .base import PersistentStore, dropbox_permission_err_retry
9
- from .json import JSONPersistentStore
10
- from .zarr import ZarrPersistentStore
10
+ from hpcflow.sdk.persistence.base import PersistentStore
11
+ from hpcflow.sdk.persistence.json import JSONPersistentStore
12
+ from hpcflow.sdk.persistence.zarr import ZarrPersistentStore, ZarrZipPersistentStore
11
13
 
12
- ALL_STORE_FORMATS = ("zarr", "json")
14
+ ALL_STORE_CLS = {
15
+ "zarr": ZarrPersistentStore,
16
+ "zip": ZarrZipPersistentStore,
17
+ "json": JSONPersistentStore,
18
+ # "json-single": JSONPersistentStore, # TODO
19
+ }
13
20
  DEFAULT_STORE_FORMAT = "zarr"
21
+ ALL_STORE_FORMATS = tuple(ALL_STORE_CLS.keys())
22
+ ALL_CREATE_STORE_FORMATS = tuple(
23
+ k for k, v in ALL_STORE_CLS.items() if v._features.create
24
+ )
14
25
 
15
26
 
16
- def store_cls_from_path(workflow_path: Path) -> Type[PersistentStore]:
17
- if ZarrPersistentStore.path_has_store(workflow_path):
18
- return ZarrPersistentStore
19
- elif JSONPersistentStore.path_has_store(workflow_path):
20
- return JSONPersistentStore
21
- else:
22
- raise WorkflowNotFoundError(
23
- f"No workflow of a known store type found at path: {workflow_path!r}."
24
- )
25
-
26
-
27
- def store_cls_from_str(store_format: str) -> Type[PersistentStore]:
28
- if store_format == "zarr":
29
- return ZarrPersistentStore
30
- elif store_format == "json":
31
- return JSONPersistentStore
32
- else:
27
+ def store_cls_from_str_NEW(store_format: str) -> Type[PersistentStore]:
28
+ try:
29
+ return ALL_STORE_CLS[store_format]
30
+ except KeyError:
33
31
  raise ValueError(f"Store format {store_format!r} not known.")
34
-
35
-
36
- @dropbox_permission_err_retry
37
- def temporary_workflow_rename(path):
38
- """Rename an existing same-path workflow directory so we can restore it if workflow
39
- creation fails"""
40
- temp_ext = "".join(random.choices(string.ascii_letters, k=10))
41
- replaced_dir = path.with_suffix(f"{path.suffix}.{temp_ext}")
42
- path.rename(replaced_dir)
43
- return replaced_dir