Skip to content

Commit

Permalink
[Feature] Add graceful experiment termination upon interrupt
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Bettini <[email protected]>
  • Loading branch information
matteobettini committed Sep 26, 2023
1 parent 53fb082 commit 43308cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions benchmarl/experiment/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,12 @@ def _setup_logger(self):
def run(self):
try:
self._collection_loop()
except KeyboardInterrupt as interrupt:
print("\n\nExperiment was closed gracefully\n\n")
self.close()
raise interrupt
except Exception as err:
print("\n\nExperiment failed and is closing gracefully\n\n")
self.close()
raise err

Expand Down

0 comments on commit 43308cc

Please sign in to comment.