Skip to content

Commit

Permalink
Print total number of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mmazurekgda committed Nov 22, 2023
1 parent 1c21672 commit 123fcf1
Showing 1 changed file with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions status_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class StatusChecker:
"FAIL": "F:",
}

hidden_platform_prefix = "x86_64_v2-centos7-gcc11"
hidden_platform_prefix_re = r"x86_64_v2(-centos7)?(-gcc11)?"

# there is no way you can get the list of build ids
Expand Down Expand Up @@ -127,6 +126,8 @@ def _fetch_build_info(
parsed = response.json()
if parsed["aborted"]:
return df, parsed_date
errors_summary = defaultdict(lambda: 0)
failed_summary = defaultdict(lambda: 0)
for project in parsed["projects"]:
if (
project["name"] in self.projects_to_check
Expand Down Expand Up @@ -155,11 +156,21 @@ def _fetch_build_info(
tmp_res = []
for check_type, check_values in self.result_types.items():
tmp_tmp_res = []
for result_type, result_name in check_values.items():
for result_name in check_values.values():
try:
counter = int(results[check_type][result_name])
if counter:
if result_name == "errors":
errors_summary[
project["name"]
] += counter
if result_name == "FAIL":
failed_summary[
project["name"]
] += counter
tmp_tmp_res.append(
f"{self.parsed_result_type[result_name]}"
f"{str(results[check_type][result_name])}"
f"{counter}"
)
except TypeError:
tmp_tmp_res = ["UNKNOWN"]
Expand Down Expand Up @@ -189,7 +200,7 @@ def _fetch_build_info(
",".join(failed_MRs),
*ptf_res,
]
return df, parsed["date"]
return df, parsed["date"], errors_summary, failed_summary

@request
def check_status(
Expand All @@ -200,6 +211,8 @@ def check_status(
filepath: str = "",
):
msgs = defaultdict(dict)
errors_summary = defaultdict(lambda: 0)
failed_summary = defaultdict(lambda: 0)
for slot, build_id in self._slots.items():
tmp_build_id = build_id
for day_delta in range(days):
Expand All @@ -214,7 +227,12 @@ def check_status(
msg = f"Cannot find {slot} for {parsed_date}"
logging.error(msg)
raise ValueError(msg)
df, retrieved_date = self._fetch_build_info(
(
df,
retrieved_date,
error_summary_tmp,
failed_summary_tmp,
) = self._fetch_build_info(
slot,
tmp_build_id,
parsed_date,
Expand All @@ -233,6 +251,10 @@ def check_status(
msgs[slot][date_back]["df"] = df.reset_index(
drop=True
)
for pr, ers in error_summary_tmp.items():
errors_summary[pr] += ers
for pr, frs in failed_summary_tmp.items():
failed_summary[pr] += frs
break
except AttributeError as err:
logging.warning(
Expand Down Expand Up @@ -280,3 +302,15 @@ def check_status(
f.write(stream)
else:
logging.info(stream)
for project, counter in errors_summary.items():
logging.warning(
f" Found in total {counter} ERRORs in "
f"BUILDING the project '{project}'. "
"Verify this and report if this is not known."
)
for project, counter in failed_summary.items():
logging.warning(
f" Found in total {counter} FAILED TESTs in "
f"the project '{project}'. "
"Verify this and report if this is not known."
)

0 comments on commit 123fcf1

Please sign in to comment.