Retry to convert report also on subprocess error

issue10938
review370221002
This commit is contained in:
Cédric Krier committed 2021-11-19 23:54:57 +01:00
1 parent 1250c434af
commit a89d1799e8
1 file changed
+10 -2
+10 -2
View File
@@ -372,14 +372,22 @@ class Report(URLMixin, PoolBase):
for count in range(retry, -1, -1):
if count != retry:
time.sleep(0.02 * (retry - count))
subprocess.check_call(cmd, timeout=timeout)
try:
subprocess.check_call(cmd, timeout=timeout)
except subprocess.CalledProcessError:
if count:
continue
logger.error(
"fail to convert %s to %s", report.report_name, oext,
exc_info=True)
break
if os.path.exists(output):
with open(output, 'rb') as fp:
return oext, fp.read()
else:
logger.error(
'fail to convert %s to %s', report.report_name, oext)
return input_format, data
return input_format, data
finally:
try:
os.remove(path)