|
15 | 15 | logger = logging.getLogger(__name__)
|
16 | 16 |
|
17 | 17 |
|
18 |
| -def get_failure_infos(limit: int, sort: Collection[str], |
19 |
| - filters: dict[str, Any] |
20 |
| - ) -> tuple[list[swatbuild.Build], userdata.UserInfos]: |
21 |
| - """Get consolidated list of failure infos and local reviews infos.""" |
22 |
| - userinfos = userdata.UserInfos() |
23 |
| - |
24 |
| - logger.info("Loading build failures...") |
25 |
| - |
26 |
| - statusfilter = None |
27 |
| - if len(filters.get('triage', [])) == 1: |
28 |
| - statusfilter = filters['triage'][0] |
29 |
| - failures = swatbotrest.get_failures(statusfilter) |
30 |
| - |
31 |
| - # Generate a list of all pending failures, fetching details from the remote |
32 |
| - # server as needed. |
| 18 | +def _create_builds(filters: dict[str, Any], |
| 19 | + failures: dict[int, dict[int, dict]], |
| 20 | + limit: int, |
| 21 | + userinfos: userdata.UserInfos): |
33 | 22 | logger.info("Loading build failures details...")
|
34 | 23 | infos = []
|
35 | 24 | limited_pending_ids = sorted(failures.keys(), reverse=True)[:limit]
|
36 | 25 | jobs = []
|
| 26 | + |
| 27 | + # Generate a list of all pending failures, fetching details from the remote |
| 28 | + # server as needed. |
37 | 29 | with concurrent.futures.ThreadPoolExecutor(max_workers=8) as executor:
|
38 | 30 | for buildid in limited_pending_ids:
|
39 | 31 | # Filter on status now, limiting the size of data we will have to
|
@@ -63,6 +55,24 @@ def get_failure_infos(limit: int, sort: Collection[str],
|
63 | 55 | executor.shutdown(cancel_futures=True)
|
64 | 56 | raise
|
65 | 57 |
|
| 58 | + return infos |
| 59 | + |
| 60 | + |
| 61 | +def get_failure_infos(limit: int, sort: Collection[str], |
| 62 | + filters: dict[str, Any] |
| 63 | + ) -> tuple[list[swatbuild.Build], userdata.UserInfos]: |
| 64 | + """Get consolidated list of failure infos and local reviews infos.""" |
| 65 | + userinfos = userdata.UserInfos() |
| 66 | + |
| 67 | + logger.info("Loading build failures...") |
| 68 | + |
| 69 | + statusfilter = None |
| 70 | + if len(filters.get('triage', [])) == 1: |
| 71 | + statusfilter = filters['triage'][0] |
| 72 | + failures = swatbotrest.get_failures(statusfilter) |
| 73 | + |
| 74 | + infos = _create_builds(filters, failures, limit, userinfos) |
| 75 | + |
66 | 76 | def sortfn(elem):
|
67 | 77 | return elem.get_sort_tuple([swatbuild.Field(k) for k in sort])
|
68 | 78 |
|
|
0 commit comments