Improve error reporting for not_done jobs in buildah

If a job times out in buildah, very little information is reported.
This patch adds a list of exceptions that were thrown by incomplete
jobs to the SystemError exception that gets raised.

Change-Id: I3526144934fd04a9996975f6e8610c2029d16f67
(cherry picked from commit 326852ed5e)
This commit is contained in:
Mike Turek 2019-11-13 16:24:40 +00:00 committed by Emilien Macchi
parent 3823085e51
commit a868f4b64e
2 changed files with 16 additions and 6 deletions

View File

@ -210,11 +210,21 @@ class BuildahBuilder(base.BaseBuilder):
raise SystemError(job._exception)
else:
if not_done:
raise SystemError(
'The following jobs were incomplete: {}'.format(
not_done
)
)
error_msg = ('The following jobs were '
'incomplete: {}'.format(not_done))
exceptions_raised = [job._exception for job in not_done
if job._exception]
if exceptions_raised:
error_msg = error_msg + os.linesep + (
"%(raised_count)d of the incomplete "
"jobs threw exceptions: %(exceptions)s" %
{'raised_count': len(exceptions_raised),
'exceptions': exceptions_raised})
raise SystemError(error_msg)
elif isinstance(deps, (dict,)):
for container in deps:
self._generate_container(container)

View File

@ -39,7 +39,7 @@ BUILD_ALL_STR_CONTAINER = 'container1'
class ThreadPoolExecutorReturn(object):
pass
_exception = None
class ThreadPoolExecutorReturnFailed(object):