-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rerun errored #483
Rerun errored #483
Conversation
Codecov Report
@@ Coverage Diff @@
## master #483 +/- ##
==========================================
+ Coverage 82.85% 82.99% +0.14%
==========================================
Files 20 20
Lines 4035 4035
Branches 1116 1116
==========================================
+ Hits 3343 3349 +6
+ Misses 494 491 -3
+ Partials 198 195 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
pydra/engine/core.py
Outdated
if result is not None: | ||
return result | ||
if not result.errored: | ||
return result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps change to:
if result is not None and not result.errored:
return result
both here and in the next patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good fix. It does the same thing and is more concise.
pydra/engine/tests/test_task.py
Outdated
|
||
task = pass_odds(name="pass_odds", x=[1, 2, 3, 4, 5], cache_dir=tmpdir).split("x") | ||
|
||
task() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, the extra task() should be removed.
pydra/engine/tests/test_task.py
Outdated
|
||
with pytest.raises(Exception, match="even error") as exinfo: | ||
task() | ||
print("...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove print.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept the print("...") just to make a distinction in the stdout of running the task the first time versus the second time. print("...") could be removed, but I based the assert statements on stdout, so the assert statements would have to be adjusted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if a print is needed, a logger instead of print so that it gets captured better by pytest.
pydra/engine/tests/test_workflow.py
Outdated
|
||
with pytest.raises(Exception) as exinfo: | ||
wf() | ||
print("...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove print.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept the print("...") just to make a distinction in the stdout of running the task the first time versus the second time. print("...") could be removed, but I based the assert statements on stdout, so the assert statements would have to be adjusted.
Also cleaned up testing code as recommended by PR comments.
@satra I implemented most of the recommendations you made for this PR. However, I ran into issues trying to track the output of a logger inside pydra tasks, so I kept the print statements. To attempt to avoid picking up print statements from elsewhere, I count print output only containing a string used in these tests. |
pydra/engine/tests/test_workflow.py
Outdated
wf.add(pass_odds(name="pass_odds", x=[1, 2, 3, 4, 5]).split("x")) | ||
wf.set_output([("out", wf.pass_odds.lzout.out)]) | ||
|
||
with pytest.raises(Exception) as exinfo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with pytest.raises(Exception) as exinfo: | |
with pytest.raises(Exception): |
pydra/engine/tests/test_workflow.py
Outdated
|
||
with pytest.raises(Exception) as exinfo: | ||
wf() | ||
with pytest.raises(Exception) as exinfo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with pytest.raises(Exception) as exinfo: | |
with pytest.raises(Exception): |
pydra/engine/tests/test_workflow.py
Outdated
if "(error)" in line: | ||
errors_found += 1 | ||
|
||
# There should have been 5 messages of the form "x%2 = XXX" after calling task() the second time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# There should have been 5 messages of the form "x%2 = XXX" after calling task() the second time | |
# There should have been 5 messages of the form "x%2 = XXX" after calling task() the first time |
pydra/engine/tests/test_workflow.py
Outdated
# There should have been 5 messages of the form "x%2 = XXX" after calling task() the second time | ||
# There should have been 2 messages of the form "x%2 = XXX" after calling task() the second time | ||
assert tasks_run == 7 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# There should have been 2 messages with "error" after calling task() the first time | |
# and 2 another messages after calling the second time |
pydra/engine/tests/test_task.py
Outdated
|
||
task = pass_odds(name="pass_odds", x=[1, 2, 3, 4, 5], cache_dir=tmpdir).split("x") | ||
|
||
with pytest.raises(Exception, match="even error") as exinfo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with pytest.raises(Exception, match="even error") as exinfo: | |
with pytest.raises(Exception, match="even error"): |
pydra/engine/tests/test_task.py
Outdated
|
||
with pytest.raises(Exception, match="even error") as exinfo: | ||
task() | ||
with pytest.raises(Exception, match="even error") as exinfo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with pytest.raises(Exception, match="even error") as exinfo: | |
with pytest.raises(Exception, match="even error"): |
pydra/engine/tests/test_task.py
Outdated
if "(error)" in line: | ||
errors_found += 1 | ||
|
||
# There should have been 5 messages of the form "x%2 = XXX" after calling task() the second time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# There should have been 5 messages of the form "x%2 = XXX" after calling task() the second time | |
# There should have been 5 messages of the form "x%2 = XXX" after calling task() the first time |
pydra/engine/tests/test_task.py
Outdated
# There should have been 5 messages of the form "x%2 = XXX" after calling task() the second time | ||
# There should have been 2 messages of the form "x%2 = XXX" after calling task() the second time | ||
assert tasks_run == 7 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# There should have been 2 messages with "error" after calling task() the first time | |
# and 2 another messages after calling the second time |
@chasejohnson3 - thanks for the PR! I've added just a few suggestions |
@djarecka Thanks for the feedback! I addressed your recommendations in the most recent commit. |
Thanks! I believe it's ready to merge? or are you planning to add anything more? |
I am not planning on making any more changes. Go ahead and merge |
Acknowledgment
Types of changes
Summary
When a workflow or task errors and its result is stored in cache, rerunning the same workflow/task again should rerun all
errored tasks and workflows (as discussed with @satra in #482 )
Checklist
(we are using
black
: you canpip install pre-commit
,run
pre-commit install
in thepydra
directoryand
black
will be run automatically with each commit)