Skip to content

[autorevert] implement autorevert and fix detection logic #6983

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

Merged
merged 7 commits into from
Aug 12, 2025
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
6 changes: 5 additions & 1 deletion aws/lambda/pytorch-auto-revert/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ venv/bin/lintrunner: venv/bin/python
run-local: venv/bin/python
venv/bin/python -m pytorch_auto_revert

.PHONY: run-local-dry
run-local-dry: venv/bin/python
venv/bin/python -m pytorch_auto_revert --dry-run

.PHONY: run-local-workflows
run-local-workflows: venv/bin/python
venv/bin/python -m pytorch_auto_revert autorevert-checker Lint trunk pull inductor linux-binary-manywheel --hours 4320 --ignore-common-errors
venv/bin/python -m pytorch_auto_revert autorevert-checker Lint trunk pull inductor linux-binary-manywheel --hours 4380 --ignore-common-errors

deployment.zip:
mkdir -p deployment
Expand Down
17 changes: 12 additions & 5 deletions aws/lambda/pytorch-auto-revert/pytorch_auto_revert/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def get_opts() -> argparse.Namespace:
type=int,
default=int(os.environ.get("GITHUB_INSTALLATION_ID", "0")),
)
parser.add_argument(
"--dry-run",
action="store_true",
help="Show what would be restarted without actually doing it (use with --do-restart)",
)

# no subcommand runs the lambda flow
subparsers = parser.add_subparsers(dest="subcommand")
Expand Down Expand Up @@ -91,9 +96,9 @@ def get_opts() -> argparse.Namespace:
help="Actually restart workflows for detected autorevert patterns",
)
workflow_parser.add_argument(
"--dry-run",
"--do-revert",
action="store_true",
help="Show what would be restarted without actually doing it (use with --do-restart)",
help="When restarts complete and secondary pattern matches, log REVERT",
)
workflow_parser.add_argument(
"--ignore-common-errors",
Expand Down Expand Up @@ -173,18 +178,20 @@ def main(*args, **kwargs) -> None:
"inductor",
"linux-binary-manywheel",
],
do_restart=True,
do_revert=False,
hours=2,
verbose=True,
do_restart=True,
dry_run=False,
dry_run=opts.dry_run,
ignore_common_errors=True,
)
elif opts.subcommand == "autorevert-checker":
autorevert_checker(
opts.workflows,
do_restart=opts.do_restart,
do_revert=opts.do_revert,
hours=opts.hours,
verbose=opts.verbose,
do_restart=opts.do_restart,
dry_run=opts.dry_run,
ignore_common_errors=opts.ignore_common_errors,
)
Expand Down
Loading