Skip to content

Commit bb57372

Browse files
committed
adding a test that propagates splitter two multiple tasks - small temporary fix to the state class
1 parent 63a20de commit bb57372

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

pydra/engine/state.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def splitter_final(self):
136136

137137
@property
138138
def splitter_rpn(self):
139+
# TODO NOW: this also changes other_states (properly, but should be explicite)
139140
_splitter_rpn = hlpst.splitter2rpn(
140141
deepcopy(self.splitter), other_states=self.other_states
141142
)
@@ -273,6 +274,7 @@ def update_connections(self, new_other_states=None, new_combiner=None):
273274
if new_other_states:
274275
self.other_states = new_other_states
275276
self._connect_splitters()
277+
self.splitter_rpn # TODO: temporary fix
276278
if new_combiner:
277279
self.combiner = new_combiner
278280
self.set_input_groups()

pydra/engine/tests/test_workflow.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,33 @@ def test_wf_ndst_9(plugin):
829829
assert wf.output_dir.exists()
830830

831831

832+
# workflows with structures A -> B -> C
833+
834+
835+
@pytest.mark.parametrize("plugin", Plugins)
836+
def test_wf_3sernd_ndst_1(plugin):
837+
""" workflow with three "serial" tasks, checking if the splitter is propagating"""
838+
wf = Workflow(name="wf_3sernd_ndst_1", input_spec=["x", "y"])
839+
wf.add(multiply(name="mult", x=wf.lzin.x, y=wf.lzin.y).split(["x", "y"]))
840+
wf.add(add2(name="add2_1st", x=wf.mult.lzout.out))
841+
wf.add(add2(name="add2_2nd", x=wf.add2_1st.lzout.out))
842+
wf.inputs.x = [1, 2]
843+
wf.inputs.y = [11, 12]
844+
wf.set_output([("out", wf.add2_2nd.lzout.out)])
845+
wf.plugin = plugin
846+
847+
with Submitter(plugin=plugin) as sub:
848+
sub(wf)
849+
850+
results = wf.result()
851+
assert results.output.out[0] == 13
852+
assert results.output.out[1] == 14
853+
assert results.output.out[2] == 24
854+
assert results.output.out[3] == 26
855+
# checking the output directory
856+
assert wf.output_dir.exists()
857+
858+
832859
# workflows with structures A -> C, B -> C
833860

834861

0 commit comments

Comments
 (0)