Skip to content

Commit

Permalink
Merge pull request microsoft#461 from Derek-Wds/main
Browse files Browse the repository at this point in the history
Fix exception hook bug
  • Loading branch information
you-n-g committed Jun 7, 2021
2 parents babf8aa + 4b6edae commit 61eae45
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions qlib/workflow/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def experiment_exit_handler():
Thus, if any exception or user interuption occurs beforehead, we should handle them first. Once `R` is
ended, another call of `R.end_exp` will not take effect.
"""
signal.signal(signal.SIGINT, experiment_kill_signal_handler) # handle user keyboard interupt
sys.excepthook = experiment_exception_hook # handle uncaught exception
atexit.register(R.end_exp, recorder_status=Recorder.STATUS_FI) # will not take effect if experiment ends

Expand All @@ -39,10 +38,3 @@ def experiment_exception_hook(type, value, tb):
print(f"{type.__name__}: {value}")

R.end_exp(recorder_status=Recorder.STATUS_FA)


def experiment_kill_signal_handler(signum, frame):
"""
End an experiment when user kill the program through keyboard (CTRL+C, etc.).
"""
R.end_exp(recorder_status=Recorder.STATUS_FA)

0 comments on commit 61eae45

Please sign in to comment.