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

Allow force quitting using ^C twice #54

Merged
merged 1 commit into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ ignore_missing_imports = True
[mypy-scipy]
ignore_missing_imports = True

[mypy-scipy.*]
ignore_missing_imports = True

[mypy-joblib]
ignore_missing_imports = True

Expand Down
9 changes: 7 additions & 2 deletions pykoop/lmi_regressors.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@

def _sigint_handler(sig, frame):
"""Signal handler for ^C."""
print('Stop requested. Regression will terminate at next iteration...')
global polite_stop
polite_stop = True
if not polite_stop:
print('Stop requested. Regression will stop safely at next iteration. '
'Press ^C again to force quit.')
polite_stop = True
else:
print('Force quitting now.')
exit()


signal.signal(signal.SIGINT, _sigint_handler)
Expand Down