Skip to content

Commit

Permalink
keep old
Browse files Browse the repository at this point in the history
  • Loading branch information
maxime-desroches committed Oct 9, 2024
1 parent 48abdf8 commit b2c3896
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
7 changes: 4 additions & 3 deletions selfdrive/test/process_replay/model_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,17 @@ def comment_replay_report(proposed, master, full_logs):

GITHUB.upload_files(DATA_BUCKET, [(x[0], tmp + '/' + x[0]) for x in files])

log_name = get_log_fn(TEST_ROUTE, get_commit())
commit = get_commit()
log_name = get_log_fn(TEST_ROUTE, commit)
save_log(log_name, full_logs)
GITHUB.upload_file(DATA_BUCKET, os.path.basename(log_name), log_name)

diff_files = [x for x in files if not x[1]]
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"new ref: {link}/{log_name}" + diff_plots + all_plots
GITHUB.comment_on_pr(comment, "commaci-public", PR_BRANCH)
comment = f"ref for commit {commit}: {link}/{log_name}" + diff_plots + all_plots
GITHUB.comment_on_pr(comment, PR_BRANCH)

def trim_logs_to_max_frames(logs, max_frames, frs_types, include_all_types):
all_msgs = []
Expand Down
22 changes: 12 additions & 10 deletions tools/lib/github_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,20 @@ def get_pr_number(self, pr_branch):
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, commenter, pr_branch):
def comment_on_pr(self, comment, pr_branch, commenter="", overwrite=False):
pr_number = self.get_pr_number(pr_branch)
data = f'{{"body": "{comment}"}}'
github_path = f'issues/{pr_number}/comments'
r = self.api_call(github_path)
comments = [x['id'] for x in r.json() if x['user']['login'] == commenter]
if comments:
github_path = f'issues/comments/{comments[0]}'
self.api_call(github_path, data=data, method=HTTPMethod.PATCH)
else:
github_path=f'issues/{pr_number}/comments'
self.api_call(github_path, data=data, method=HTTPMethod.POST)
if overwrite:
github_path = f'issues/{pr_number}/comments'
r = self.api_call(github_path)
comments = [x['id'] for x in r.json() if x['user']['login'] == commenter]
if comments:
github_path = f'issues/comments/{comments[0]}'
self.api_call(github_path, data=data, method=HTTPMethod.PATCH)
return

github_path=f'issues/{pr_number}/comments'
self.api_call(github_path, data=data, method=HTTPMethod.POST)

# upload files to github and comment them on the pr
def comment_images_on_pr(self, title, commenter, pr_branch, bucket, images):
Expand Down

0 comments on commit b2c3896

Please sign in to comment.