diff --git a/contest/results-collector.py b/contest/results-collector.py index c1f30ed5..2c6a9ff5 100755 --- a/contest/results-collector.py +++ b/contest/results-collector.py @@ -494,9 +494,10 @@ def build_combined(fetcher, remote_db): report_broken_remote(remote, error) for entry in results: + if entry['branch'] not in branch_info: + continue + if not entry['url']: # Executor is running - if entry['branch'] not in branch_info: - continue data = entry.copy() when = datetime.datetime.fromisoformat(branch_info[entry['branch']]['date']) data["start"] = str(when) diff --git a/pw_brancher.py b/pw_brancher.py index 7e5c79f3..fbf3c8e0 100755 --- a/pw_brancher.py +++ b/pw_brancher.py @@ -391,10 +391,7 @@ def dump_branches(config, state) -> None: "url": pub_url + " " + name}) write_json_atomic(config.get("output", "branches"), data) - - info = config.get("output", "info") - with open(info, 'w') as fp: - json.dump(state["info"], fp) + write_json_atomic(config.get("output", "info"), state["info"]) log_end_sec() diff --git a/pw_contest.py b/pw_contest.py index f118bb15..1f1b2c36 100755 --- a/pw_contest.py +++ b/pw_contest.py @@ -27,6 +27,8 @@ patch_state=state.json [www] contest=https://server-with-ui/contest.html +[patchwork] +check_name=contest """ class Codes: @@ -223,16 +225,16 @@ def skip_update(outcome) -> bool: return False -def update_one(pw, patch_id, outcome, link): +def update_one(pw, patch_id, outcome, link, check_name): description = outcome['branch'] if outcome["code"] >= 0: description += f' (tests: {outcome["cnt"]})' url = link + '?pw-n=0&branch=' + outcome['branch'] - pw.post_check(patch_id, name="contest", state=code_to_pw[outcome["code"]], + pw.post_check(patch_id, name=check_name, state=code_to_pw[outcome["code"]], url=url, desc=description) -def _patch_state_update(pw, state: dict, link: str): +def _patch_state_update(pw, state: dict, link: str, check_name: str): update_cnt = 0 for series_id, outcome in state["series"].items(): if skip_update(outcome): @@ -242,7 +244,7 @@ def _patch_state_update(pw, state: dict, link: str): log_open_sec('Updating series ' + series_id) series_pw = pw.get("series", series_id) for patch in series_pw["patches"]: - update_one(pw, patch["id"], outcome, link) + update_one(pw, patch["id"], outcome, link, check_name) update_cnt += 1 del outcome["update"] @@ -255,7 +257,7 @@ def _patch_state_update(pw, state: dict, link: str): try: log_open_sec('Updating PR ' + pr_id) - update_one(pw, pr_id, outcome, link) + update_one(pw, pr_id, outcome, link, check_name) update_cnt += 1 del outcome["update"] @@ -265,10 +267,10 @@ def _patch_state_update(pw, state: dict, link: str): print("Updated", update_cnt, "pw things") -def patch_state_update(pw, state: dict, link: str): +def patch_state_update(pw, state: dict, link: str, check_name: str): log_open_sec('Updating patch states') try: - _patch_state_update(pw, state, link) + _patch_state_update(pw, state, link, check_name) finally: log_end_sec() @@ -291,7 +293,8 @@ def main_loop(pw) -> int: results_by_branch = results_pivot(filters, results) branch_outcome = branch_summarize(filters, results_by_branch) patch_state_compute(patch_state, branches, branch_outcome) - patch_state_update(pw, patch_state, config.get('www', 'contest')) + patch_state_update(pw, patch_state, config.get('www', 'contest'), + config.get('patchwork', 'check_name', fallback='contest')) rbb = config.get('output', 'results_by_branch', fallback=None) if rbb: diff --git a/scripts/ui_assets.sh b/scripts/ui_assets.sh index 0fc8e449..ec4ce6e9 100755 --- a/scripts/ui_assets.sh +++ b/scripts/ui_assets.sh @@ -20,7 +20,9 @@ ASSETS=( "status.json" "issues.json" "contest/branch-results.json" - "contest/branches-info.json" + "contest/branch-results-hw.json" + "contest/branches-info-nn.json" + "contest/branches-info-hw.json" "contest/filters.json" "contest/all-results.json" ) diff --git a/ui/contest.js b/ui/contest.js index d0b0297b..03f18ff4 100644 --- a/ui/contest.js +++ b/ui/contest.js @@ -173,7 +173,7 @@ function load_result_table(data_raw) function find_branch_urls(loaded_data) { $.each(loaded_data, function(i, v) { - if (v.remote == "brancher") + if (v.executor == "brancher") branch_urls[v.branch] = v.results[0].link; }); } diff --git a/ui/status.js b/ui/status.js index f9ae59ad..3a297f19 100644 --- a/ui/status.js +++ b/ui/status.js @@ -735,7 +735,7 @@ function load_result_table_one(data_raw, table, reported, avgs) var a = ""; - if (v.remote != "brancher") { + if (v.executor != "brancher") { var time = row.insertCell(2); if (link) @@ -862,24 +862,8 @@ function runner_name(v) function load_result_table(data_raw, reload) { - var branch_pull_status = {}; var branch_start = {}; - // Parse branch info to extract pull status - $.each(branches_info, function(i, v) { - let summary = null; - $.each(v['base-pulls'], function(url, res) { - if (res == "okay" && !summary) { - summary = res; - } else if (res == "resolved" && (!summary || summary == "okay")) { - summary = res; - } else { - summary = res; - } - }); - branch_pull_status[i] = summary; - }); - // Decorate branchers and collect branch_start $.each(data_raw, function(i, v) { v.start = new Date(v.start); @@ -890,7 +874,7 @@ function load_result_table(data_raw, reload) branches.add(v.branch); - if (v.remote == "brancher") { + if (v.executor == "brancher") { branch_start[v.branch] = v.start; v.pull_status = branch_pull_status[v.branch]; } @@ -1036,9 +1020,9 @@ function load_result_table(data_raw, reload) } } -let xfr_todo = 4; +let xfr_todo = 6; let all_results = null; -let branches_info = null; +let branch_pull_status = {}; let branches = new Set(); let branch_results = {}; @@ -1159,7 +1143,21 @@ function filters_doit(data_raw) function branches_loaded(data_raw) { - branches_info = data_raw; + // Parse branch info to extract pull status + $.each(data_raw, function(i, v) { + let summary = null; + $.each(v['base-pulls'], function(url, res) { + if (res == "okay" && !summary) { + summary = res; + } else if (res == "resolved" && (!summary || summary == "okay")) { + summary = res; + } else { + summary = res; + } + }); + branch_pull_status[i] = summary; + }); + loaded_one(); } @@ -1307,11 +1305,17 @@ function do_it() $(document).ready(function() { $.get("contest/branch-results.json", branch_res_doit) }); + $(document).ready(function() { + $.get("contest/branch-results-hw.json", branch_res_doit) + }); $(document).ready(function() { $.get("query/results?branches=10&pending=y", results_loaded) }); $(document).ready(function() { - $.get("contest/branches-info.json", branches_loaded) + $.get("contest/branches-info-nn.json", branches_loaded) + }); + $(document).ready(function() { + $.get("contest/branches-info-hw.json", branches_loaded) }); $(document).ready(function() { $.get("query/flaky-tests?group-pfx=1", flakes_doit)