-
Notifications
You must be signed in to change notification settings - Fork 21.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'minjean/mkldnn_tbb_support' of https://github.com/min-j…
…ean-cho/pytorch into minjean/mkldnn_tbb_support
- Loading branch information
Showing
151 changed files
with
17,983 additions
and
1,136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ebee0a27940adfbb30444d83387b9ea0f1173f40 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ebee0a27940adfbb30444d83387b9ea0f1173f40 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
24b95f2f627bf07a61cefed653419389a7586357 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
e1f5a49664b904e3ec1ddb9095ca75b6bbb5c10d | ||
eff277e81fcfdeccba71e75ff40b6e2f3e29e27b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env python3 | ||
"""check_labels.py""" | ||
|
||
from typing import Any, List | ||
from datetime import datetime, timedelta | ||
|
||
from export_pytorch_labels import get_pytorch_labels | ||
from gitutils import ( | ||
get_git_remote_name, | ||
get_git_repo_dir, | ||
GitRepo, | ||
) | ||
from trymerge import ( | ||
_fetch_url, | ||
gh_post_pr_comment, | ||
GitHubPR, | ||
) | ||
|
||
|
||
BOT_AUTHORS = ["github-actions", "pytorchmergebot", "pytorch-bot"] | ||
|
||
ERR_MSG_TITLE = "This PR needs a label" | ||
ERR_MSG = ( | ||
f"# {ERR_MSG_TITLE}\n" | ||
"If your changes are user facing and intended to be a part of release notes, please use a label starting with `release notes:`.\n\n" # noqa: E501 pylint: disable=line-too-long | ||
"If not, please add the `topic: not user facing` label.\n\n" | ||
"For more information, see https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work." # noqa: E501 pylint: disable=line-too-long | ||
) | ||
|
||
|
||
def get_release_notes_labels() -> List[str]: | ||
return [label for label in get_pytorch_labels() if label.lstrip().startswith("release notes:")] | ||
|
||
|
||
def delete_comment(comment_id: int) -> None: | ||
url = f"https://api.github.com/repos/pytorch/pytorch/issues/comments/{comment_id}" | ||
_fetch_url(url, method="DELETE") | ||
|
||
|
||
def has_required_labels(pr: GitHubPR) -> bool: | ||
pr_labels = pr.get_labels() | ||
|
||
# Check if PR is not user facing | ||
is_not_user_facing_pr = any(label.strip() == "topic: not user facing" for label in pr_labels) | ||
if is_not_user_facing_pr: | ||
return True | ||
|
||
# Check if bot has already posted a message within the past hour to include a release notes label | ||
for comment in pr.get_comments(): | ||
if comment.body_text.lstrip(" #").startswith(ERR_MSG_TITLE) and comment.author_login in BOT_AUTHORS: | ||
ts = datetime.strptime(comment.created_at, "%Y-%m-%dT%H:%M:%SZ") | ||
if (datetime.utcnow() - ts) < timedelta(hours=1): | ||
return True | ||
delete_comment(comment.database_id) | ||
break | ||
|
||
return any(label.strip() in get_release_notes_labels() for label in pr_labels) | ||
|
||
|
||
def parse_args() -> Any: | ||
from argparse import ArgumentParser | ||
parser = ArgumentParser("Check PR labels") | ||
parser.add_argument("pr_num", type=int) | ||
|
||
return parser.parse_args() | ||
|
||
|
||
def main() -> None: | ||
args = parse_args() | ||
repo = GitRepo(get_git_repo_dir(), get_git_remote_name()) | ||
org, project = repo.gh_owner_and_name() | ||
pr = GitHubPR(org, project, args.pr_num) | ||
|
||
try: | ||
if not has_required_labels(pr): | ||
print(ERR_MSG) | ||
gh_post_pr_comment(pr.org, pr.project, pr.pr_num, ERR_MSG) | ||
exit(1) | ||
except Exception as e: | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
"dynamo", | ||
"force_on_cpu", | ||
"functorch", | ||
"inductor", | ||
"jit_legacy", | ||
"multigpu", | ||
"nogpu_AVX512", | ||
|
Oops, something went wrong.