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

Make validator respond to KeyboardInterrupts #505

Merged
merged 2 commits into from
Sep 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions optimade/validator/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,16 @@ def wrapper(

# Catch SystemExit here so that we can pass it through to the finally block,
ml-evs marked this conversation as resolved.
Show resolved Hide resolved
# but prepare to immediately throw it
except (Exception, SystemExit) as exc:
except (Exception, SystemExit, KeyboardInterrupt) as exc:
result = exc
traceback = tb.format_exc()

finally:
# This catches the case of the Client throwing a SystemExit if the server
ml-evs marked this conversation as resolved.
Show resolved Hide resolved
# did not respond, and the case of the validator "fail-fast"'ing and throwing
# a SystemExit below
ml-evs marked this conversation as resolved.
Show resolved Hide resolved
if isinstance(result, SystemExit):
raise SystemExit(result)
if isinstance(result, SystemExit) or isinstance(result, KeyboardInterrupt):
ml-evs marked this conversation as resolved.
Show resolved Hide resolved
raise result

display_request = None
try:
Expand Down