Skip to content

Commit 632fb9c

Browse files
committed
passing rerun to all tasks
1 parent 591a2dd commit 632fb9c

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

pydra/engine/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ async def _run(self, submitter=None, rerun=False, **kwargs):
811811
self.hooks.pre_run_task(self)
812812
try:
813813
self.audit.monitor()
814-
await self._run_task(submitter)
814+
await self._run_task(submitter, rerun=rerun)
815815
result.output = self._collect_outputs()
816816
except Exception as e:
817817
record_error(self.output_dir, e)
@@ -825,11 +825,11 @@ async def _run(self, submitter=None, rerun=False, **kwargs):
825825
self.hooks.post_run(self, result)
826826
return result
827827

828-
async def _run_task(self, submitter):
828+
async def _run_task(self, submitter, rerun=False):
829829
if not submitter:
830830
raise Exception("Submitter should already be set.")
831831
# at this point Workflow is stateless so this should be fine
832-
await submitter._run_workflow(self)
832+
await submitter._run_workflow(self, rerun=rerun)
833833

834834
def set_output(self, connections):
835835
"""

pydra/engine/tests/test_workflow.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2358,7 +2358,8 @@ def test_wf_nostate_cachelocations_updated(plugin, tmpdir):
23582358
def test_wf_nostate_cachelocations_recompute(plugin, tmpdir):
23592359
"""
23602360
Two wfs with the same inputs but slightly different graph;
2361-
the second wf should recompute the results
2361+
the second wf should recompute the results,
2362+
but the second node should use the results from the first wf (has the same input)
23622363
"""
23632364
cache_dir1 = tmpdir.mkdir("test_wf_cache3")
23642365
cache_dir2 = tmpdir.mkdir("test_wf_cache4")
@@ -2401,14 +2402,14 @@ def test_wf_nostate_cachelocations_recompute(plugin, tmpdir):
24012402
results2 = wf2.result()
24022403
assert 8 == results2.output.out
24032404

2404-
# checking execution time
2405-
assert t1 > 3
2406-
assert t2 > 3
2407-
24082405
# checking if both dir exists
24092406
assert wf1.output_dir.exists()
24102407
assert wf2.output_dir.exists()
24112408

2409+
# checking execution time (second task shouldn't be recompute, t2 should be small)
2410+
assert t1 > 3
2411+
assert t2 < 0.5
2412+
24122413

24132414
@pytest.mark.parametrize("plugin", Plugins)
24142415
def test_wf_ndstate_cachelocations(plugin, tmpdir):

0 commit comments

Comments
 (0)