Propagate errors from gather methods
This commit is contained in:
parent
8aab628374
commit
980ae723bc
61
1303.patch
Normal file
61
1303.patch
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
From 7f35ac622a7389a3b2077b245d7f322918b03515 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lubomír Sedlář <lsedlar@redhat.com>
|
||||||
|
Date: Nov 25 2019 13:28:34 +0000
|
||||||
|
Subject: gather: Collect and re-raise errors from gather method
|
||||||
|
|
||||||
|
|
||||||
|
When there is an exception in gathering (such as after seeing unsigned
|
||||||
|
packages in deps method), the exception was lost and the compose
|
||||||
|
continued to run until it tried to access the result and crashed on
|
||||||
|
KeyError.
|
||||||
|
|
||||||
|
Relates: https://pagure.io/releng/failed-composes/issue/587
|
||||||
|
JIRA: COMPOSE-3986
|
||||||
|
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
diff --git a/pungi/phases/gather/__init__.py b/pungi/phases/gather/__init__.py
|
||||||
|
index 444a8c2..9d54f15 100644
|
||||||
|
--- a/pungi/phases/gather/__init__.py
|
||||||
|
+++ b/pungi/phases/gather/__init__.py
|
||||||
|
@@ -443,6 +443,7 @@ def _gather_variants(result, compose, variant_type, package_sets, exclude_fulltr
|
||||||
|
continue
|
||||||
|
threads_list = []
|
||||||
|
que = Queue()
|
||||||
|
+ errors = Queue()
|
||||||
|
for arch in variant.arches:
|
||||||
|
fulltree_excludes = set()
|
||||||
|
if exclude_fulltree:
|
||||||
|
@@ -454,11 +455,17 @@ def _gather_variants(result, compose, variant_type, package_sets, exclude_fulltr
|
||||||
|
# there.
|
||||||
|
_update_lookaside_config(compose, variant, arch, result, package_sets)
|
||||||
|
|
||||||
|
+ def worker(que, errors, arch, *args, **kwargs):
|
||||||
|
+ try:
|
||||||
|
+ que.put((arch, gather_packages(*args, **kwargs)))
|
||||||
|
+ except Exception as exc:
|
||||||
|
+ errors.put(exc)
|
||||||
|
+
|
||||||
|
# Run gather_packages() in parallel with multi threads and store
|
||||||
|
# its return value in a Queue() for later use.
|
||||||
|
t = threading.Thread(
|
||||||
|
- target=lambda q, arch, *args, **kwargs: q.put((arch, gather_packages(*args, **kwargs))),
|
||||||
|
- args=(que, arch, compose, arch, variant, package_sets),
|
||||||
|
+ target=worker,
|
||||||
|
+ args=(que, errors, arch, compose, arch, variant, package_sets),
|
||||||
|
kwargs={'fulltree_excludes': fulltree_excludes},
|
||||||
|
)
|
||||||
|
threads_list.append(t)
|
||||||
|
@@ -467,6 +474,10 @@ def _gather_variants(result, compose, variant_type, package_sets, exclude_fulltr
|
||||||
|
for t in threads_list:
|
||||||
|
t.join()
|
||||||
|
|
||||||
|
+ while not errors.empty():
|
||||||
|
+ exc = errors.get()
|
||||||
|
+ raise exc
|
||||||
|
+
|
||||||
|
while not que.empty():
|
||||||
|
arch, pkg_map = que.get()
|
||||||
|
result.setdefault(arch, {})[variant.uid] = pkg_map
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: pungi
|
Name: pungi
|
||||||
Version: 4.1.40
|
Version: 4.1.40
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
Summary: Distribution compose tool
|
Summary: Distribution compose tool
|
||||||
|
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
@ -10,6 +10,7 @@ URL: https://pagure.io/pungi
|
|||||||
Source0: https://pagure.io/releases/%{name}/%{name}-%{version}.tar.bz2
|
Source0: https://pagure.io/releases/%{name}/%{name}-%{version}.tar.bz2
|
||||||
Patch1: https://pagure.io/pungi/pull-request/1292.patch
|
Patch1: https://pagure.io/pungi/pull-request/1292.patch
|
||||||
Patch2: https://pagure.io/pungi/pull-request/1295.patch
|
Patch2: https://pagure.io/pungi/pull-request/1295.patch
|
||||||
|
Patch3: https://pagure.io/pungi/pull-request/1303.patch
|
||||||
|
|
||||||
BuildRequires: python3-nose
|
BuildRequires: python3-nose
|
||||||
BuildRequires: python3-mock
|
BuildRequires: python3-mock
|
||||||
@ -143,6 +144,9 @@ nosetests-3 --exe
|
|||||||
%{_bindir}/%{name}-wait-for-signed-ostree-handler
|
%{_bindir}/%{name}-wait-for-signed-ostree-handler
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 26 2019 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.40-4
|
||||||
|
- Propagate errors from depsolving methods
|
||||||
|
|
||||||
* Mon Nov 11 2019 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.40-3
|
* Mon Nov 11 2019 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.40-3
|
||||||
- pkgset: Fix running without any koji tags
|
- pkgset: Fix running without any koji tags
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user