Merge branch 'master_14.2.2' into asm_14.2.2

Former-commit-id: 5c9880c3179bf376798bb5658aec3666bddd7d3e
This commit is contained in:
Brian.Dyke 2014-08-18 11:47:38 -04:00
commit d82d58d38e

View file

@ -89,6 +89,7 @@ from com.raytheon.uf.edex.database.cluster import ClusterTask
# 02/04/14 17042 ryu Check in changes for randerso. # 02/04/14 17042 ryu Check in changes for randerso.
# 04/11/2014 17242 David Gillingham (code checked in by zhao) # 04/11/2014 17242 David Gillingham (code checked in by zhao)
# 07/22/2014 17484 randerso Update cluster lock time to prevent time out # 07/22/2014 17484 randerso Update cluster lock time to prevent time out
# 08/07/2014 3517 randerso Improved memory utilization and error handling when unzipping input file.
# #
BATCH_DELAY = 0.0 BATCH_DELAY = 0.0
@ -538,25 +539,39 @@ class IscMosaic:
gzipFile = None gzipFile = None
unzippedFile = None unzippedFile = None
gzipped = True
try: try:
import gzip import gzip
gzipFile = gzip.open(filename, 'rb') gzipFile = gzip.open(filename, 'rb')
unzippedFile = open(filename + ".unzipped", 'w') unzippedFile = open(filename + ".unzipped", 'w')
unzippedFile.write(gzipFile.read()) while True:
buffer = gzipFile.read(65536)
if len(buffer) == 0:
break
unzippedFile.write(buffer)
except IOError as e:
if e.message == "Not a gzipped file":
gzipped = False
else:
raise
else:
# no errors, close and rename the file
unzippedFile.close() unzippedFile.close()
gzipFile.close() gzipFile.close()
os.rename(unzippedFile.name, gzipFile.filename) os.rename(unzippedFile.name, gzipFile.filename)
except: gzipFile = unzippedFile = None
# Not gzipped finally:
# close the files in case of error
if gzipFile is not None: if gzipFile is not None:
gzipFile.close() gzipFile.close()
if unzippedFile is not None: if unzippedFile is not None:
unzippedFile.close() unzippedFile.close()
os.remove(unzippedFile.name) if not gzipped:
os.remove(unzippedFile.name)
a = os.times() a = os.times()
cpu = a[0] + a[1] cpugz = a[0] + a[1]
stop1 = a[4] stopgz = a[4]
file = NetCDF.NetCDFFile(filename, "r") file = NetCDF.NetCDFFile(filename, "r")
@ -656,15 +671,15 @@ class IscMosaic:
SendNotifications.send(notification) SendNotifications.send(notification)
a = os.times() a = os.times()
cpugz = a[0] + a[1] cpu = a[0] + a[1]
stop = a[4] stop = a[4]
logger.info("Elapsed/CPU time: " logger.info("Elapsed/CPU time: "
"%-.2f / %-.2f decompress, " "%-.2f / %-.2f decompress, "
"%-.2f / %-.2f processing, " "%-.2f / %-.2f processing, "
"%-.2f / %-.2f total", "%-.2f / %-.2f total",
stop1 - start, cpu - cpu0, stopgz - start, cpugz - cpu0,
stop - stop1, cpugz - cpu, stop - stopgz, cpu - cpugz,
stop - start, cpugz - cpu0) stop - start, cpu - cpu0)
def __processParm(self, parmName, vars, history, filename): def __processParm(self, parmName, vars, history, filename):