Skip to content

Commit

Permalink
[ez] Fix revert printer after #4703 (#4727)
Browse files Browse the repository at this point in the history
Forgot about this one in
#4703.

Also change _event_time usage to created
  • Loading branch information
clee2000 authored Nov 13, 2023
1 parent 90cea6d commit 85e4c10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/revert-tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
fetch-depth: 0
- id: generate-reverts-file
run: |
cd test-infra
cd test-infra/tools
python3 -m pip install rockset==1.0.3
python3 -m torchci.scripts.reverts
python3 -m torchci.reverts
echo "revert_file=$(cat revert_file_name.txt)" >> "${GITHUB_OUTPUT}"
env:
ROCKSET_API_KEY: ${{ secrets.ROCKSET_API_KEY }}
Expand All @@ -35,7 +35,7 @@ jobs:
env:
API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }}
with:
source_file: test-infra/${{ steps.generate-reverts-file.outputs.revert_file }}
source_file: test-infra/tools/${{ steps.generate-reverts-file.outputs.revert_file }}
destination_repo: "pytorch/test-infra"
destination_folder: "reverts"
destination_branch: generated-stats
Expand Down
10 changes: 6 additions & 4 deletions tools/torchci/reverts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import re
import shlex
from collections import defaultdict
from pathlib import Path
from typing import Dict, List, Optional, Tuple

from rockset import RocksetClient # type: ignore[import]
Expand All @@ -12,6 +13,8 @@
# Should match the contents produced by trymerge on revert
RE_REVERT_COMMIT_BODY = r"Reverted .* on behalf of .* due to .* \(\[comment\]\((.*)\)\)"

REPO_ROOT = Path(__file__).resolve().parent.parent.parent

CLASSIFICATIONS = {
"nosignal": "No Signal",
"ignoredsignal": "Ignored Signal",
Expand All @@ -23,7 +26,6 @@

ROCKSET_REVERT_QUERY = """
SELECT
ic._event_time revert_time,
ic.user.login as reverter,
ic.body,
ic.html_url as comment_url
Expand All @@ -34,8 +36,8 @@
ic.body,
'@pytorch(merge|)bot +revert'
)
AND ic._event_time >= PARSE_TIMESTAMP_ISO8601(:startTime)
AND ic._event_time < PARSE_TIMESTAMP_ISO8601(:stopTime)
AND ic.created >= PARSE_TIMESTAMP_ISO8601(:startTime)
AND ic.created < PARSE_TIMESTAMP_ISO8601(:stopTime)
AND ic.user.login != 'pytorch-bot[bot]'
"""

Expand Down Expand Up @@ -104,7 +106,7 @@ def get_rockset_reverts(start_time: str, end_time: str) -> Dict[str, Dict[str, s


def get_gitlog_reverts(start_time: str, end_time: str) -> List[GitCommit]:
repo_path = "../pytorch"
repo_path = REPO_ROOT / ".." / "pytorch"
remote = "origin"
repo = GitRepo(repo_path, remote)
all_commits = repo._run_git_log(
Expand Down

0 comments on commit 85e4c10

Please sign in to comment.