Skip to content

Commit

Permalink
Use group_inputs and group_outputs when creating Task
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Sep 22, 2024
1 parent c04d416 commit f8f6fa3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions aiida_workgraph/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,9 @@ def build_task_from_workgraph(wg: any) -> Task:
"type": tdata["metadata"]["task_type"],
"is_pickle": False,
}
tdata["metadata"]["group_outputs"] = group_outputs
tdata["executor"] = executor
task = create_task(tdata)
task.group_outputs = group_outputs
return task


Expand Down Expand Up @@ -501,6 +501,8 @@ def generate_tdata(
properties: List[Tuple[str, str]],
catalog: str,
task_type: str,
group_inputs: List[Tuple[str, str]] = None,
group_outputs: List[Tuple[str, str]] = None,
additional_data: Optional[Dict[str, Any]] = None,
) -> Dict[str, Any]:
"""Generate task data for creating a task."""
Expand All @@ -524,6 +526,8 @@ def generate_tdata(
"task_type": task_type,
"catalog": catalog,
"node_class": {"module": "aiida_workgraph.task", "name": "Task"},
"group_inputs": group_inputs or [],
"group_outputs": group_outputs or [],
},
"properties": properties,
"inputs": _inputs,
Expand Down Expand Up @@ -634,10 +638,11 @@ def decorator(func):
properties or [],
catalog,
task_type,
group_inputs=inputs,
group_outputs=outputs,
)

task = create_task(tdata)
task.group_inputs = inputs
task.group_outputs = outputs
func.task = func.node = task
return func

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies = [
"numpy~=1.21",
"scipy",
"ase",
"node-graph>=0.1.0",
"node-graph==0.1.1",
"aiida-core>=2.3",
"cloudpickle",
"aiida-shell~=0.8",
Expand Down

0 comments on commit f8f6fa3

Please sign in to comment.