Skip to content
Snippets Groups Projects
Commit cecb6f4e authored by Nick Bearson's avatar Nick Bearson
Browse files

timeout if gridding + tiling ever takes longer than 10 minutes (#26)

parent 01f4cd7a
No related branches found
No related tags found
1 merge request!131.0b1rc2 fixups
...@@ -44,6 +44,7 @@ import shutil ...@@ -44,6 +44,7 @@ import shutil
import atexit import atexit
from glob import glob from glob import glob
import socket import socket
import signal
from netCDF4 import Dataset from netCDF4 import Dataset
#from multiprocessing import freeze_support # https://docs.python.org/2/library/multiprocessing.html#multiprocessing.freeze_support #from multiprocessing import freeze_support # https://docs.python.org/2/library/multiprocessing.html#multiprocessing.freeze_support
from functools import partial from functools import partial
...@@ -300,8 +301,13 @@ def add_gglm_attrs(netcdf_filename, input_filenames): ...@@ -300,8 +301,13 @@ def add_gglm_attrs(netcdf_filename, input_filenames):
except: except:
log.error("could not add CSPP Geo GGLM attributes to {}".format(netcdf_filename)) log.error("could not add CSPP Geo GGLM attributes to {}".format(netcdf_filename))
def alarm_handler(signum, frame):
raise OSError("Timeout exceeded!")
if __name__ == '__main__': if __name__ == '__main__':
signal.signal(signal.SIGALRM, alarm_handler)
signal.alarm(10*60) # timeout if we're not done after 10 minutes
# freeze_support() # nb. I don't think this is needed as we're not making windows execs at this time # freeze_support() # nb. I don't think this is needed as we're not making windows execs at this time
parser = create_parser() parser = create_parser()
args = parser.parse_args() args = parser.parse_args()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment