Skip to content
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

Always raise, don't swallow exception, if exception is KeyboardInterrupt in ProtocolUnit.execute #215

Merged
merged 6 commits into from
Sep 1, 2023

Conversation

dotsdl
Copy link
Member

@dotsdl dotsdl commented Aug 8, 2023

This PR is an attempt to address openforcefield/alchemiscale#132.

@mikemhenry raised a good point that for the case of a KeyboardInterrupt, even if raise_error = False for ProtocolUnit.execute, we probably always want to raise.

Is there any downside to this?

@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (2028a63) 99.12% compared to head (9146ea8) 99.12%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #215   +/-   ##
=======================================
  Coverage   99.12%   99.12%           
=======================================
  Files          36       36           
  Lines        1829     1831    +2     
=======================================
+ Hits         1813     1815    +2     
  Misses         16       16           
Files Changed Coverage Δ
gufe/protocols/protocolunit.py 97.24% <100.00%> (+0.03%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dotsdl dotsdl requested a review from dwhswenson August 8, 2023 16:59
@dwhswenson
Copy link
Member

My only concern would be if INT is being used elsewhere, e.g., by a queueing system, in which case we'd want to catch it and terminate cleanly. (Which also might be an option here, anyway.)

The queueing systems I know send TERM or USR2, followed by a KILL; I'm not aware of one using INT, but I don't claim to know them all!

If we ever handle mid-unit restarts, we'll need to handle KeyboardInterrupt with a little more logic, but that's easily added. Otherwise, seems reasonable -- either needs a test or exclude from coverage.

@dotsdl
Copy link
Member Author

dotsdl commented Aug 17, 2023

@dwhswenson thanks for this! I've added an explicit test for the new behavior.

As for the concern you raised about queueing systems, I think you're right that SIGINT generally isn't used for terminating jobs, so I think we're still good here.

@mikemhenry mikemhenry enabled auto-merge (squash) September 1, 2023 20:47
@mikemhenry mikemhenry merged commit 0b611a5 into main Sep 1, 2023
7 checks passed
@mikemhenry mikemhenry deleted the always-raise-keyboard-interrupt branch September 1, 2023 20:48
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.

None yet

3 participants