forked from NCAR/CESM_postprocessing
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated support for Grace. Other fixes from Alper's repo for HR
- Loading branch information
Abishek Gopal
committed
Jul 12, 2021
1 parent
7830672
commit 83f0f4a
Showing
8 changed files
with
373 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import signal | ||
class timeout: | ||
def __init__(self, seconds=1, error_message='Timeout'): | ||
self.seconds = seconds | ||
self.error_message = error_message | ||
def handle_timeout(self, signum, frame): | ||
raise TimeoutError(self.error_message) | ||
def __enter__(self): | ||
signal.signal(signal.SIGALRM, self.handle_timeout) | ||
signal.alarm(self.seconds) | ||
def __exit__(self, type, value, traceback): | ||
signal.alarm(0) | ||
|
||
class TimeoutError(Exception): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.