python-workflow-definition 0.1.2__py2.py3-none-any.whl → 0.1.4__py2.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.
- python_workflow_definition/__init__.py +3 -0
- python_workflow_definition/_version.py +34 -0
- python_workflow_definition/aiida.py +3 -3
- python_workflow_definition/models.py +19 -2
- python_workflow_definition/pyiron_base.py +19 -5
- {python_workflow_definition-0.1.2.dist-info → python_workflow_definition-0.1.4.dist-info}/METADATA +5 -5
- {python_workflow_definition-0.1.2.dist-info → python_workflow_definition-0.1.4.dist-info}/RECORD +9 -8
- {python_workflow_definition-0.1.2.dist-info → python_workflow_definition-0.1.4.dist-info}/WHEEL +1 -1
- {python_workflow_definition-0.1.2.dist-info → python_workflow_definition-0.1.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '0.1.4'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 1, 4)
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = None
|
|
@@ -6,7 +6,7 @@ from aiida_pythonjob.data.serializer import general_serializer
|
|
|
6
6
|
from aiida_workgraph import WorkGraph, task, Task, namespace
|
|
7
7
|
from aiida_workgraph.socket import TaskSocketNamespace
|
|
8
8
|
from dataclasses import replace
|
|
9
|
-
from node_graph.
|
|
9
|
+
from node_graph.task_spec import SchemaSource
|
|
10
10
|
from python_workflow_definition.models import PythonWorkflowDefinitionWorkflow
|
|
11
11
|
from python_workflow_definition.shared import (
|
|
12
12
|
convert_nodes_list_to_dict,
|
|
@@ -109,9 +109,9 @@ def write_workflow_json(wg: WorkGraph, file_name: str) -> dict:
|
|
|
109
109
|
# if the from socket is the default result, we set it to None
|
|
110
110
|
if link_data["from_socket"] == "result":
|
|
111
111
|
link_data["from_socket"] = None
|
|
112
|
-
link_data[TARGET_LABEL] = node_name_mapping[link_data.pop("
|
|
112
|
+
link_data[TARGET_LABEL] = node_name_mapping[link_data.pop("to_task")]
|
|
113
113
|
link_data[TARGET_PORT_LABEL] = link_data.pop("to_socket")
|
|
114
|
-
link_data[SOURCE_LABEL] = node_name_mapping[link_data.pop("
|
|
114
|
+
link_data[SOURCE_LABEL] = node_name_mapping[link_data.pop("from_task")]
|
|
115
115
|
link_data[SOURCE_PORT_LABEL] = link_data.pop("from_socket")
|
|
116
116
|
data[EDGES_LABEL].append(link_data)
|
|
117
117
|
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import (
|
|
3
|
+
List,
|
|
4
|
+
Union,
|
|
5
|
+
Optional,
|
|
6
|
+
Literal,
|
|
7
|
+
Any,
|
|
8
|
+
Annotated,
|
|
9
|
+
Type,
|
|
10
|
+
TypeVar,
|
|
11
|
+
)
|
|
12
|
+
from typing_extensions import TypeAliasType
|
|
3
13
|
from pydantic import BaseModel, Field, field_validator, field_serializer
|
|
4
14
|
from pydantic import ValidationError
|
|
5
15
|
import json
|
|
@@ -19,6 +29,13 @@ __all__ = (
|
|
|
19
29
|
)
|
|
20
30
|
|
|
21
31
|
|
|
32
|
+
JsonPrimitive = Union[str, int, float, bool, None]
|
|
33
|
+
AllowableDefaults = TypeAliasType(
|
|
34
|
+
"AllowableDefaults",
|
|
35
|
+
"Union[JsonPrimitive, dict[str, AllowableDefaults], list[AllowableDefaults]]",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
22
39
|
class PythonWorkflowDefinitionBaseNode(BaseModel):
|
|
23
40
|
"""Base model for all node types, containing common fields."""
|
|
24
41
|
|
|
@@ -33,7 +50,7 @@ class PythonWorkflowDefinitionInputNode(PythonWorkflowDefinitionBaseNode):
|
|
|
33
50
|
|
|
34
51
|
type: Literal["input"]
|
|
35
52
|
name: str
|
|
36
|
-
value: Optional[
|
|
53
|
+
value: Optional[AllowableDefaults] = None
|
|
37
54
|
|
|
38
55
|
|
|
39
56
|
class PythonWorkflowDefinitionOutputNode(PythonWorkflowDefinitionBaseNode):
|
|
@@ -285,18 +285,32 @@ def write_workflow_json(
|
|
|
285
285
|
)
|
|
286
286
|
|
|
287
287
|
nodes_store_lst = []
|
|
288
|
-
|
|
288
|
+
translate_dict = {}
|
|
289
|
+
for i, k in enumerate(list(nodes_new_dict.keys())[::-1]):
|
|
290
|
+
v = nodes_new_dict[k]
|
|
291
|
+
translate_dict[k] = i
|
|
289
292
|
if isfunction(v):
|
|
290
293
|
mod = v.__module__
|
|
291
294
|
if mod == "python_workflow_definition.pyiron_base":
|
|
292
295
|
mod = "python_workflow_definition.shared"
|
|
293
296
|
nodes_store_lst.append(
|
|
294
|
-
{"id":
|
|
297
|
+
{"id": i, "type": "function", "value": mod + "." + v.__name__}
|
|
295
298
|
)
|
|
296
299
|
elif isinstance(v, np.ndarray):
|
|
297
|
-
nodes_store_lst.append({"id":
|
|
300
|
+
nodes_store_lst.append({"id": i, "type": "input", "value": v.tolist()})
|
|
298
301
|
else:
|
|
299
|
-
nodes_store_lst.append({"id":
|
|
302
|
+
nodes_store_lst.append({"id": i, "type": "input", "value": v})
|
|
303
|
+
|
|
304
|
+
print(translate_dict)
|
|
305
|
+
edges_store_lst = [
|
|
306
|
+
{
|
|
307
|
+
TARGET_LABEL: translate_dict[edge[TARGET_LABEL]],
|
|
308
|
+
TARGET_PORT_LABEL: edge[TARGET_PORT_LABEL],
|
|
309
|
+
SOURCE_LABEL: translate_dict[edge[SOURCE_LABEL]],
|
|
310
|
+
SOURCE_PORT_LABEL: edge[SOURCE_PORT_LABEL],
|
|
311
|
+
}
|
|
312
|
+
for edge in edges_new_lst
|
|
313
|
+
]
|
|
300
314
|
|
|
301
315
|
PythonWorkflowDefinitionWorkflow(
|
|
302
316
|
**set_result_node(
|
|
@@ -304,7 +318,7 @@ def write_workflow_json(
|
|
|
304
318
|
workflow_dict={
|
|
305
319
|
VERSION_LABEL: VERSION_NUMBER,
|
|
306
320
|
NODES_LABEL: nodes_store_lst,
|
|
307
|
-
EDGES_LABEL:
|
|
321
|
+
EDGES_LABEL: edges_store_lst,
|
|
308
322
|
}
|
|
309
323
|
)
|
|
310
324
|
)
|
{python_workflow_definition-0.1.2.dist-info → python_workflow_definition-0.1.4.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python_workflow_definition
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Python Workflow Definition - workflow interoperability for aiida, jobflow and pyiron
|
|
5
5
|
Author-email: Jan Janssen <janssen@mpie.de>, Janine George <janine.geogre@bam.de>, Julian Geiger <julian.geiger@psi.ch>, Xing Wang <xing.wang@psi.ch>, Marnik Bercx <marnik.bercx@psi.ch>, Christina Ertural <christina.ertural@bam.de>
|
|
6
6
|
License: BSD 3-Clause License
|
|
@@ -34,14 +34,14 @@ License: BSD 3-Clause License
|
|
|
34
34
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
35
|
License-File: LICENSE
|
|
36
36
|
Requires-Dist: numpy>=1.21
|
|
37
|
-
Requires-Dist: pydantic
|
|
37
|
+
Requires-Dist: pydantic<2.13.0,>=2.7.0
|
|
38
38
|
Provides-Extra: aiida
|
|
39
|
-
Requires-Dist: aiida-workgraph<=0.
|
|
39
|
+
Requires-Dist: aiida-workgraph<=0.8.1,>=0.5.1; extra == 'aiida'
|
|
40
40
|
Provides-Extra: jobflow
|
|
41
|
-
Requires-Dist: jobflow<=0.
|
|
41
|
+
Requires-Dist: jobflow<=0.3.1,>=0.1.18; extra == 'jobflow'
|
|
42
42
|
Provides-Extra: plot
|
|
43
43
|
Requires-Dist: ipython<=9.8.0,>=7.33.0; extra == 'plot'
|
|
44
44
|
Requires-Dist: networkx<=3.5,>=2.8.8; extra == 'plot'
|
|
45
45
|
Requires-Dist: pygraphviz<=1.14,>=1.10; extra == 'plot'
|
|
46
46
|
Provides-Extra: pyiron
|
|
47
|
-
Requires-Dist: pyiron-base<=0.15.
|
|
47
|
+
Requires-Dist: pyiron-base<=0.15.12,>=0.11.10; extra == 'pyiron'
|
{python_workflow_definition-0.1.2.dist-info → python_workflow_definition-0.1.4.dist-info}/RECORD
RENAMED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
python_workflow_definition/__init__.py,sha256=
|
|
2
|
-
python_workflow_definition/
|
|
1
|
+
python_workflow_definition/__init__.py,sha256=h99LG51BctvOaZSCwDOOD1-t_5dNHVNnf2aaWFOnyiQ,106
|
|
2
|
+
python_workflow_definition/_version.py,sha256=rLCrf4heo25FJtBY-2Ap7ZuWW-5FS7sqTjsolIUuI5c,704
|
|
3
|
+
python_workflow_definition/aiida.py,sha256=r0BdIGIbJbHELPGhUKDTqErXTp_ctehaZnek0xHVEoA,6115
|
|
3
4
|
python_workflow_definition/executorlib.py,sha256=lRMIPznpNX5yrtybhN0Ghb13ED-LABcUXgorzuBqQ6Q,2309
|
|
4
5
|
python_workflow_definition/jobflow.py,sha256=gZmtcD4JMg5qdoyDdvlpwM6MgR_mOocDEMQ4ZUvNJRk,12378
|
|
5
|
-
python_workflow_definition/models.py,sha256=
|
|
6
|
+
python_workflow_definition/models.py,sha256=R9Kclp4fGlg4H--NHNohjgat1WTDDpO7pis5r-_lX8c,9049
|
|
6
7
|
python_workflow_definition/plot.py,sha256=Y_X2HF2kCXaoIdi-b7ZMdySUIb6S1pjL2hwHRu3Zey8,1633
|
|
7
8
|
python_workflow_definition/purepython.py,sha256=-9PcmYttKpgpcUiEwknfsLDDjL7PW0TsEu-A-57uv6Y,3321
|
|
8
|
-
python_workflow_definition/pyiron_base.py,sha256=
|
|
9
|
+
python_workflow_definition/pyiron_base.py,sha256=kgUaVNGqmwY4fv2fZx6ErA0THl97xIDEmHcShqNicm4,11608
|
|
9
10
|
python_workflow_definition/pyiron_workflow.py,sha256=UuzykgWI6YkecMKcX2lZtTx-hY3wH2fOCqLvNnm0VxA,15035
|
|
10
11
|
python_workflow_definition/shared.py,sha256=t0YKxpXYfPFxs6KqmjGy4oU89xcUHO1xANzxBE5oP7c,3468
|
|
11
12
|
python_workflow_definition/cwl/__init__.py,sha256=GTYsSbkzsRZPQ2NW4Rxf-bLVyZlW6B00sNf9Uz0DsW4,7750
|
|
12
13
|
python_workflow_definition/cwl/__main__.py,sha256=x5QHMqPt-J3EpSNKNNzE0v9GH6eiM8hVE43iNEf7y28,1584
|
|
13
|
-
python_workflow_definition-0.1.
|
|
14
|
-
python_workflow_definition-0.1.
|
|
15
|
-
python_workflow_definition-0.1.
|
|
16
|
-
python_workflow_definition-0.1.
|
|
14
|
+
python_workflow_definition-0.1.4.dist-info/METADATA,sha256=nl1g43Ts-QThIM0vSC2hLG2dOM87NgIVV9y6pcerC_U,2672
|
|
15
|
+
python_workflow_definition-0.1.4.dist-info/WHEEL,sha256=aha0VrrYvgDJ3Xxl3db_g_MDIW-ZexDdrc_m-Hk8YY4,105
|
|
16
|
+
python_workflow_definition-0.1.4.dist-info/licenses/LICENSE,sha256=weTxRQ0keMOdgE0qJlsyCAIgm3BB62Bb3mS6_4iUv7Q,1511
|
|
17
|
+
python_workflow_definition-0.1.4.dist-info/RECORD,,
|
|
File without changes
|