Skip to content

Commit 288b016

Browse files
committed
FIx file names as input
1 parent 4538453 commit 288b016

5 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/python_workflow_definition/aiida.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ def load_workflow_json(file_name: str) -> WorkGraph:
3030
wg = WorkGraph()
3131
task_name_mapping = {}
3232

33+
nodes_types_dict = {int(n["id"]): n["type"] for n in data[NODES_LABEL]}
3334
for id, identifier in convert_nodes_list_to_dict(
3435
nodes_list=data[NODES_LABEL]
3536
).items():
36-
if isinstance(identifier, str) and "." in identifier:
37+
if nodes_types_dict[int(k)] == "function" and isinstance(identifier, str) and "." in identifier:
3738
p, m = identifier.rsplit(".", 1)
3839
mod = import_module(p)
3940
func = getattr(mod, m)

src/python_workflow_definition/executorlib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ def load_workflow_json(file_name: str, exe: Executor):
4747
edges_new_lst = content[EDGES_LABEL]
4848
nodes_new_dict = {}
4949

50+
nodes_types_dict = {int(n["id"]): n["type"] for n in content[NODES_LABEL]}
5051
for k, v in convert_nodes_list_to_dict(nodes_list=content[NODES_LABEL]).items():
51-
if isinstance(v, str) and "." in v:
52+
if nodes_types_dict[int(k)] == "function" and isinstance(v, str) and "." in v:
5253
p, m = v.rsplit(".", 1)
5354
mod = import_module(p)
5455
nodes_new_dict[int(k)] = getattr(mod, m)

src/python_workflow_definition/jobflow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,9 @@ def load_workflow_json(file_name: str) -> Flow:
295295
)
296296

297297
nodes_new_dict = {}
298+
nodes_types_dict = {int(n["id"]): n["type"] for n in content[NODES_LABEL]}
298299
for k, v in convert_nodes_list_to_dict(nodes_list=content[NODES_LABEL]).items():
299-
if isinstance(v, str) and "." in v:
300+
if nodes_types_dict[int(k)] == "function" and isinstance(v, str) and "." in v:
300301
p, m = v.rsplit(".", 1)
301302
mod = import_module(p)
302303
nodes_new_dict[int(k)] = getattr(mod, m)

src/python_workflow_definition/purepython.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ def load_workflow_json(file_name: str):
7575

7676
edges_new_lst = content[EDGES_LABEL]
7777
nodes_new_dict = {}
78+
nodes_types_dict = {int(n["id"]): n["type"] for n in content[NODES_LABEL]}
7879
for k, v in convert_nodes_list_to_dict(nodes_list=content[NODES_LABEL]).items():
79-
if isinstance(v, str) and "." in v:
80+
if nodes_types_dict[int(k)] == "function" and isinstance(v, str) and "." in v:
8081
p, m = v.rsplit(".", 1)
8182
mod = import_module(p)
8283
nodes_new_dict[int(k)] = getattr(mod, m)

src/python_workflow_definition/pyiron_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,10 @@ def load_workflow_json(file_name: str, project: Optional[Project] = None):
239239
)
240240

241241
edges_new_lst = content[EDGES_LABEL]
242+
nodes_types_dict = {int(n["id"]): n["type"] for n in content[NODES_LABEL]}
242243
nodes_new_dict = {}
243244
for k, v in convert_nodes_list_to_dict(nodes_list=content[NODES_LABEL]).items():
244-
if isinstance(v, str) and "." in v:
245+
if nodes_types_dict[int(k)] == "function" and isinstance(v, str) and "." in v:
245246
p, m = v.rsplit(".", 1)
246247
if p == "python_workflow_definition.shared":
247248
p = "python_workflow_definition.pyiron_base"

0 commit comments

Comments
 (0)