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
This commit is contained in:
Mike Turek 2019-11-13 16:24:40 +00:00
parent 07c7889ca5
commit 326852ed5e
2 changed files with 16 additions and 6 deletions

View File

@ -186,11 +186,21 @@ class BuildahBuilder(base.BaseBuilder):
raise SystemError(job._exception) raise SystemError(job._exception)
else: else:
if not_done: if not_done:
raise SystemError( error_msg = ('The following jobs were '
'The following jobs were incomplete: {}'.format( 'incomplete: {}'.format(not_done))
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,)): elif isinstance(deps, (dict,)):
for container in deps: for container in deps:
self._generate_container(container) self._generate_container(container)

View File

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