diff --git a/openpilot/selfdrive/test/process_replay/model_replay.py b/openpilot/selfdrive/test/process_replay/model_replay.py index a4f9fcfb2b..8f43f4066b 100755 --- a/openpilot/selfdrive/test/process_replay/model_replay.py +++ b/openpilot/selfdrive/test/process_replay/model_replay.py @@ -85,7 +85,7 @@ def generate_report(proposed, master, tmp, commit): ], "driverStateV2") return [plot(map(v[0], get_event(proposed, event)), \ - map(v[0], get_event(master, event)), f"{v[1]}_{commit[:7]}", tmp) \ + map(v[0], get_event(master, event)), f"{v[1]}_{'chestnut' if CHESTNUT else 'tici'}_{commit[:7]}", tmp) \ for v,event in ([*ModelV2_Plots] + [*DriverStateV2_Plots])] def create_table(title, files, link, open_table=False): @@ -105,7 +105,8 @@ def create_table(title, files, link, open_table=False): def comment_replay_report(proposed, master, full_logs): with tempfile.TemporaryDirectory() as tmp: PR_BRANCH = os.getenv("GIT_BRANCH","") - DATA_BUCKET = f"model_replay_{PR_BRANCH}" + model_type = "chestnut" if CHESTNUT else "tici" + DATA_BUCKET = f"model_replay_{PR_BRANCH}_{model_type}" try: GITHUB.get_pr_number(PR_BRANCH) @@ -126,8 +127,9 @@ def comment_replay_report(proposed, master, full_logs): link = GITHUB.get_bucket_link(DATA_BUCKET) diff_plots = create_table("Model Replay Differences", diff_files, link, open_table=True) all_plots = create_table("All Model Replay Plots", files, link) - comment = f"ref for commit {commit}: {link}/{log_name}" + diff_plots + all_plots - GITHUB.comment_on_pr(comment, PR_BRANCH, "commaci-public", True) + model_title = "Big model (Chestnut)" if CHESTNUT else "Small model" + comment = f"

Model Replay: {model_title}

ref for commit {commit}: {link}/{log_name}" + diff_plots + all_plots + GITHUB.comment_on_pr(comment, PR_BRANCH, "commaci-public", True, comment_marker=f"_model_{model_type}_") def trim_logs(logs, start_frame, end_frame, frs_types, include_all_types): all_msgs = [] @@ -290,8 +292,7 @@ if __name__ == "__main__": diff_short, diff_long, failed = format_diff(results, log_paths, 'master') if "CI" in os.environ: - if not CHESTNUT: - comment_replay_report(log_msgs, cmp_log, log_msgs) + comment_replay_report(log_msgs, cmp_log, log_msgs) failed = False print(diff_long) print('-------------\n'*5) diff --git a/openpilot/tools/lib/github_utils.py b/openpilot/tools/lib/github_utils.py index 6a443b4155..1e473398c3 100644 --- a/openpilot/tools/lib/github_utils.py +++ b/openpilot/tools/lib/github_utils.py @@ -84,13 +84,13 @@ class GithubUtils: def get_bucket_link(self, bucket): return f'https://raw.githubusercontent.com/{self.OWNER}/{self.DATA_REPO}/refs/heads/{bucket}' - def comment_on_pr(self, comment, pr_branch, commenter="", overwrite=False): + def comment_on_pr(self, comment, pr_branch, commenter="", overwrite=False, comment_marker=""): pr_number = self.get_pr_number(pr_branch) data = f'{{"body": "{comment}"}}' github_path = f'issues/{pr_number}/comments' if overwrite: r = self.api_call(github_path) - comments = [x['id'] for x in r.json() if x['user']['login'] == commenter] + comments = [x['id'] for x in r.json() if x['user']['login'] == commenter and (not comment_marker or comment_marker in x['body'])] if comments: github_path = f'issues/comments/{comments[0]}' self.api_call(github_path, data=data, method=HTTPMethod.PATCH)