Skip to content

feat: timeouts#457

Open
tristan-f-r wants to merge 21 commits intoReed-CompBio:mainfrom
tristan-f-r:timeout-arg
Open

feat: timeouts#457
tristan-f-r wants to merge 21 commits intoReed-CompBio:mainfrom
tristan-f-r:timeout-arg

Conversation

@tristan-f-r
Copy link
Copy Markdown
Collaborator

@tristan-f-r tristan-f-r commented Jan 13, 2026

Adds timeout to algorithms as a demonstration of passing through errors. Closes #316.

Caveat: ML requires at least one pathway, and failing pathways can break ML-work. How do we want to handle downstream analysis when errors occur (including in the future heuristic errors?)

@tristan-f-r tristan-f-r added the enhancement New feature or request label Jan 13, 2026
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Jan 13, 2026

Documentation build overview

📚 spras | 🛠️ Build #32419831 | 📁 Comparing 7a0c4f3 against latest (87b314c)

  🔍 Preview build  

6 files changed · + 2 added · ± 4 modified

+ Added

± Modified

@tristan-f-r tristan-f-r added the P-high This is a blocker for many PRs/issues/features label Jan 13, 2026
@github-actions github-actions Bot added the merge-conflict This PR has merge conflicts. label Jan 31, 2026
@github-actions github-actions Bot removed the merge-conflict This PR has merge conflicts. label Jan 31, 2026
@ntalluri
Copy link
Copy Markdown
Collaborator

ntalluri commented Feb 5, 2026

This does not work with singularity (singularity has no docker wait equivalent and to implement timeouts in singularity would probably require constant polling of a detached thread)

This is a problem; if this is something we are going to use for the benchmarking study we need this to work with singularity because CHTC only uses singularity/apptainer.

@tristan-f-r
Copy link
Copy Markdown
Collaborator Author

tristan-f-r commented Feb 5, 2026

I originally assumed this was a more esoteric PR to test the error-handling workflow. Though, based on the meeting just now, I'll look into a nice way to get this working with Singularity.

@github-actions github-actions Bot added the merge-conflict This PR has merge conflicts. label Mar 18, 2026
Copy link
Copy Markdown
Collaborator

@ntalluri ntalluri left a comment

Choose a reason for hiding this comment

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

Here is my first round review. I like the empty files if an error occurs, and it is good to have an associated log explaining why.
(Adding this comment again here) My only issue with this is the definition of "error." If a parameter combination fails the heuristics check, I do not want the output to be empty. I want the output to reflect what was actually produced, so I do not have to rerun that combination even though it "failed" the heuristics. I should be able to freely update the heuristics and have that output counted if it now passes, without rerunning combinations that previously produced empty output. In short, a parameter combination failing the heuristics should not be classified as an error as defined in this PR.

This PR not working with singularity is a very big problem because of the chtc integration.

"ML requires at least one pathway, and failing pathways can break ML-work. How do we want to handle downstream analysis when errors occur." This seems like a separate problem that I will fix internally in the ML code (I want to still make figures if we only have one pathway or a set of empty pathways).

Comment thread config/config.yaml
Comment thread spras/analysis/cytoscape.py
Comment thread spras/config/config.py
Comment thread spras/containers.py
Comment thread spras/prm.py
Comment thread Snakefile Outdated
Comment thread Snakefile Outdated
Comment thread Snakefile
Comment thread Snakefile
Comment thread Snakefile
tristan-f-r and others added 4 commits April 23, 2026 19:31
This perplexes me but from my tests we do not need --keep-going. I do not know my original intent here
Co-Authored-By: Neha Talluri <78840540+ntalluri@users.noreply.github.com>
@tristan-f-r
Copy link
Copy Markdown
Collaborator Author

tristan-f-r commented Apr 23, 2026

My only issue with this is the definition of "error." If a parameter combination fails the heuristics check, I do not want the output to be empty. I want the output to reflect what was actually produced, so I do not have to rerun that combination even though it "failed" the heuristics.

The small part here that is adaptable is that errors, in this PR, are only made in the reconstruct rule. We can define other errors in some heuristics rule, and we can rewire other rules to depend on the success of heuristics instead of on reconstruct (via that resource_info = rules.reconstruct.output.resource_info input rule above, but instead we would say rules.heuristics.output.resource_info instead.)

@github-actions github-actions Bot removed the merge-conflict This PR has merge conflicts. label Apr 23, 2026
@tristan-f-r
Copy link
Copy Markdown
Collaborator Author

This works with apptainer now, but this now touches an untested part of profiling, so that part needs a review from @jhiemstrawisc.

Copy link
Copy Markdown
Collaborator

@ntalluri ntalluri left a comment

Choose a reason for hiding this comment

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

here is half of a review on this pr

Comment thread docs/design/errors.rst

By default, whenever SPRAS runs into a container error (i.e. an internal
algorithm error), the full workflow will fail. However, there are
certain designated errors where we don't want this to be the case (at
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we make this a separate section that explains each error instead of putting it in parentheses (even though right now it is only timeouts). We can expand this in the future.

Comment thread docs/timeout.rst
timeout: 1d

The timeout string parsing is delegated to `pytimeparse
<https://pypi.org/project/pytimeparse/>`__, which allows for more
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<https://pypi.org/project/pytimeparse/>`__, which allows for more
<https://pypi.org/project/pytimeparse/>`__, (examples linked here). This allows for more

Comment thread docs/timeout.rst
Timeouts
##########

SPRAS allows for per-algorithm timeouts, specified under the global
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
SPRAS allows for per-algorithm timeouts, specified under the global
SPRAS allows for optional per-algorithm timeouts, specified under the global

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can you also add a sentence on what happens when timeout is not included?

Comment thread spras/containers.py

def __init__(self, timeout: int, *args):
self.timeout = timeout
self.message = f"Timed out after {timeout}s."
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could we convert this back into other time scales (if I put 5.6 days I don't want to have to read that as 483840 seconds).

Suggested change
self.message = f"Timed out after {timeout}s."
self.message = f"Timed out after {timeout} seconds."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

f"Timed out after {timeout} seconds; {hours} hours; {days} days ."

Something like this?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

(only do this if it is easy to do)

Comment thread spras/containers.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request P-high This is a blocker for many PRs/issues/features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generic spras limit option on containers

2 participants