Skip to content

Commit d323ec7

Browse files
committed
handle the case where a non-lazy field (i.e. passed directly from an input) is returned as an output of the workflow
1 parent e7926ec commit d323ec7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pydra/compose/workflow.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,11 @@ def _from_job(cls, job: "Job[WorkflowTask]") -> ty.Self:
334334
values = {}
335335
lazy_field: LazyOutField
336336
for name, lazy_field in attrs_values(workflow.outputs).items():
337-
val_out = lazy_field._get_value(workflow=workflow, graph=exec_graph)
337+
val_out = (
338+
lazy_field._get_value(workflow=workflow, graph=exec_graph)
339+
if isinstance(lazy_field, LazyOutField)
340+
else lazy_field
341+
)
338342
if isinstance(val_out, StateArray):
339343
val_out = list(val_out) # implicitly combine state arrays
340344
values[name] = val_out

pydra/engine/workflow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ def construct(
187187
)
188188
for outpt, outpt_lf in zip(output_fields, output_lazy_fields):
189189
# Automatically combine any uncombined state arrays into a single lists
190-
outpt_lf._type = State.combine_state_arrays(outpt_lf._type)
190+
if isinstance(outpt_lf, LazyOutField):
191+
outpt_lf._type = State.combine_state_arrays(outpt_lf._type)
191192
setattr(outputs, outpt.name, outpt_lf)
192193
else:
193194
if unset_outputs := [

0 commit comments

Comments
 (0)