Issue #2688 Return value from
subprocess.check_output is not return code, but is process output. Updated check for success. Change-Id: If06cb77406f4c5dd07a356236b7a8cae908cd2fd Former-commit-id:d5ba2ff235
[formerly810e3ee6cf
] [formerly7f4abee83c
] [formerly7f4abee83c
[formerly28440284d1
]] [formerlyd5ba2ff235
[formerly810e3ee6cf
] [formerly7f4abee83c
] [formerly7f4abee83c
[formerly28440284d1
]] [formerly8d7178cf68
[formerly7f4abee83c
[formerly28440284d1
] [formerly8d7178cf68
[formerly 8fb43f1e2a108af18c1a6908bed54e8ca71369e0]]]]] Former-commit-id:8d7178cf68
Former-commit-id:371f398fde
[formerly278d065ad1
] [formerly61653e1c1a
] [formerly 3fb42444bb1ca5d425141e2049d85cd682c01841 [formerly e2739a9c4d52d5d3e02b2f373ec3672fdc5183dc] [formerly61653e1c1a
[formerly28b1daf0e0
]]] Former-commit-id: 5a81513cc4b85b70806b35374adecbcc8e5e8c2d [formerly 0d78ac098588c7a4b3f0ed0f6eb7ea0bcb39d7e5] [formerlyff0548af38
[formerlyaef9e747dc
]] Former-commit-id:ff0548af38
Former-commit-id:d8a15c161c
This commit is contained in:
parent
527efe5b4f
commit
2d8cececb9
1 changed files with 15 additions and 2 deletions
|
@ -34,6 +34,9 @@
|
|||
# 02/12/13 #1608 randerso Added support for explicitly deleting groups and datasets
|
||||
# Nov 14, 2013 2393 bclement removed interpolation
|
||||
# Jan 17, 2014 2688 bclement added file action and subprocess error logging
|
||||
# Mar 19, 2014 2688 bgonzale added more subprocess logging. Return value from
|
||||
# subprocess.check_output is not return code, but is
|
||||
# process output. h5repack has no output without -v arg.
|
||||
#
|
||||
#
|
||||
|
||||
|
@ -773,14 +776,24 @@ class H5pyDataStore(IDataStore.IDataStore):
|
|||
else:
|
||||
repackedFullPath = filepath.replace(basePath, outDir)
|
||||
cmd = ['h5repack', '-f', compression, filepath, repackedFullPath]
|
||||
if logger.isEnabledFor(logging.DEBUG):
|
||||
cmd.insert(1, '-v')
|
||||
success = True
|
||||
ret = None
|
||||
try:
|
||||
ret = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
||||
success = (ret == 0)
|
||||
# if CalledProcessError is not raised then success
|
||||
except subprocess.CalledProcessError, e:
|
||||
logger.error("Subprocess call failed: " + str(e))
|
||||
logger.error("Subprocess args: " + " ".join(cmd))
|
||||
logger.error("Subprocess output: " + e.output)
|
||||
success = False
|
||||
|
||||
except:
|
||||
logger.exception("Unexpected error from h5repack")
|
||||
success = False
|
||||
finally:
|
||||
logger.debug("h5repack output: " + str(ret))
|
||||
|
||||
if success:
|
||||
# repack was successful, replace the old file if we did it in the
|
||||
# same directory, otherwise leave it alone
|
||||
|
|
Loading…
Add table
Reference in a new issue