Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make issue instead of PR comment #16

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions asv_watcher/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from __future__ import annotations

import pandas as pd

from asv_watcher._core.detector import RollingDetector
from asv_watcher._core.watcher import Watcher

pd.options.mode.copy_on_write = True

__all__ = ["RollingDetector", "Watcher"]


Expand Down
54 changes: 51 additions & 3 deletions asv_watcher/_core/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ def commit_range(self, git_hash):
prev_git_hash = time_series.shift(1)[
time_series.git_hash == git_hash
].git_hash.iloc[0]
base_url = "https://github.com/pandas-dev/pandas/compare/"
url = f"{base_url}{prev_git_hash}...{git_hash}"
url = f"{prev_git_hash}...{git_hash}"
return url

def get_regressions(self, git_hash: str) -> list[tuple[str, str]]:
Expand Down Expand Up @@ -81,7 +80,56 @@ def generate_report(self, git_hash: str) -> str:
"\n\n"
)

result += self.commit_range(git_hash)
base_url = "https://github.com/pandas-dev/pandas/compare/"
result += base_url + self.commit_range(git_hash)
result += "\n"

return result

def generate_report_v2(self, git_hash: str, pr: str, authors: str) -> str:
regressions = self.get_regressions(git_hash)
for_report: dict[str, list[str]] = {}
for regression in regressions:
for_report[regression[0]] = for_report.get(regression[0], []) + [
regression[1]
]

result = ""
result += (
f"PR #{pr} may have induced a performance regression. "
"If it was a necessary behavior change, this may have been "
"expected and everything is okay."
"\n\n"
"Please check the links below. If any ASVs are parameterized, "
"the combinations of parameters that a regression has been detected "
"for appear as subbullets."
"\n\n"
)

for benchmark, param_combos in for_report.items():
base_url = "https://asv-runner.github.io/asv-collection/pandas/#"
url = f"{base_url}{benchmark}"
result += f" - [ ] [{benchmark}]({url})\n"
for params in param_combos:
if params == "":
continue
params_list = [param for param in params.split("; ")]
params_suffix = "?p-" + "&p-".join(params_list)
url = f"{base_url}{benchmark}{params_suffix}"
url = urllib.parse.quote(url, safe="/:?=&#")
result += f" - [ ] [{params}]({url})\n"
result += "\n"

result += (
"Subsequent benchmarks may have skipped some commits. The link"
" below lists the commits that are"
" between the two benchmark runs where the regression was identified."
"\n\n"
)

base_url = "https://github.com/pandas-dev/pandas/compare/"
result += f"[Commit Range]({base_url + self.commit_range(git_hash)})"
result += "\n\n"
result += "cc @" + ", @".join(authors.split(", ")) + "\n"

return result
Loading
Loading