Skip to content

Add WDL --badWorker/--restart test (#5247) - #5547

Merged
adamnovak merged 2 commits into
masterfrom
issues/5247-test-wdl-restart-badworker
Jul 9, 2026
Merged

Add WDL --badWorker/--restart test (#5247)#5547
adamnovak merged 2 commits into
masterfrom
issues/5247-test-wdl-restart-badworker

Conversation

@annagiroti

Copy link
Copy Markdown
Collaborator

Changelog Entry

Added a test exercising toil-wdl-runner with --badWorker and --restart, covering the restart export crash where the --restart codepath previously didn't construct the WDLContext needed to export files. The underlying fix was already merged in #5248; this closes out the remaining test coverage for #5247.

Resolves #5247

To be copied to the draft changelog by merger:

  • PR submitter writes their recommendation for a changelog entry here

Reviewer Checklist

  • Make sure it is coming from issues/XXXX-fix-the-thing in the Toil repo, or from an external repo.
    • If it is coming from an external repo, make sure to pull it in for CI with:
      contrib/admin/test-pr otheruser theirbranchname issues/XXXX-fix-the-thing
      
    • If there is no associated issue, create one.
  • Read through the code changes. Make sure that it doesn't have:
    • Addition of trailing whitespace.
    • New variable or member names in camelCase that want to be in snake_case.
    • New functions without type hints.
    • New functions or classes without informative docstrings.
    • Changes to semantics not reflected in the relevant docstrings.
    • New or changed command line options for Toil workflows that are not reflected in docs/running/{cliOptions,cwl,wdl}.rst
    • New features without tests.
  • Comment on the lines of code where problems exist with a review comment. You can shift-click the line numbers in the diff to select multiple lines.
  • Finish the review with an overall description of your opinion.

Merger Checklist

  • Make sure the PR passed tests, including the Gitlab tests, for the most recent commit in its branch.
  • Make sure the PR has been reviewed. If not, review it. If it has been reviewed and any requested changes seem to have been addressed, proceed.
  • Merge with the Github "Squash and merge" feature.
    • If there are multiple authors' commits, add Co-authored-by to give credit to all contributing authors.
  • Copy its recommended changelog entry to the Draft Changelog.
  • Append the issue number in parentheses to the changelog entry.

@annagiroti annagiroti changed the title Add WDL --badWorker/--restart test (#5247 Add WDL --badWorker/--restart test (#5247) Jun 30, 2026

@adamnovak adamnovak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test could be faster and more or less guaranteed to both test the thing we want and to succeed, if we use different worker failure rates to set up the restart-able workflow and to finish it.

Comment thread src/toil/test/wdl/wdltoil_test.py Outdated
Comment on lines +651 to +660
"--badWorker=0.5",
"--badWorkerFailInterval=0.01",
]

result_json = None
try:
# With --badWorker, the first attempt will usually fail due to a simulated worker death, but not always
result_json = subprocess.check_output(command + ["--logCritical"])
except subprocess.CalledProcessError:
pass

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use a workflow that sleeps for longer than the bad worker interval, and --badWorker=1.0, to always fail? If we don't get a failure here the test doesn't really test what we want it to test.

Comment thread src/toil/test/wdl/wdltoil_test.py Outdated
Comment on lines +663 to +675
# Keep restarting until the workflow actually finishes,
# or give up after a bounded number of attempts so a hang fails
# loudly instead of looping forever
max_attempts = 10
for attempt in range(max_attempts):
try:
result_json = subprocess.check_output(
command + ["--restart", "--logCritical"]
)
break
except subprocess.CalledProcessError:
if attempt == max_attempts - 1:
raise

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we've prepared a workflow that we can restart, we should turn off --badWorker and finish the run in a way that we know should succeed, rather than throwing more attempts at it with the same failure settings.

Comment thread src/toil/test/wdl/wdltoil_test.py Outdated
Comment on lines +687 to +690
# Since we were catching
# <https://github.com/DataBiosphere/toil/issues/5247> at file
# export, make sure we actually exported a file, even after
# restarting from a --badWorker-induced failure

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be simplified.

Suggested change
# Since we were catching
# <https://github.com/DataBiosphere/toil/issues/5247> at file
# export, make sure we actually exported a file, even after
# restarting from a --badWorker-induced failure
# Make sure we actually exported a file, even after restarting

Comment thread src/toil/test/wdl/wdltoil_test.py
…ngle attempt without --badWorker, add assert result_json is not None
@annagiroti
annagiroti requested a review from adamnovak July 8, 2026 00:14

@adamnovak adamnovak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good to me.

@adamnovak

Copy link
Copy Markdown
Member

There's something wrong with CI here. It is running test_wait but not test_restart right after it, or the new test_restart_with_bad_worker. We try and run all the tests in the wdl directory, so it's not like those tests aren't on a list.

@adamnovak

Copy link
Copy Markdown
Member

I think whatever's going on with the missing tests is a preexisting problem.

@adamnovak

Copy link
Copy Markdown
Member

OK what's going on is those tests (and the new test) end up in quick_test_offline on CI because they are not annotated as being slow or needing Docker. The new test is indeed running and passing: https://ucsc-ci.com/databiosphere/toil/-/jobs/112697#L678

@adamnovak
adamnovak merged commit 091ed88 into master Jul 9, 2026
3 checks passed
@adamnovak
adamnovak deleted the issues/5247-test-wdl-restart-badworker branch July 9, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WDL runner can't export files after restart

2 participants