Skip to content

Commit 3e8a3be

Browse files
[AUTOREVERT] tune entry point for cli and event bridge, enabling providing custom running configurations (#7526)
Changes lambda entry point for autorevert to enable better handling eventbridge parameters. The changes are: * Moved entry point from a global `main` to specific ones for CLI and lambda; * Moved main execution logic to a reused function; * Created a general config holder interface dataclass; this enables to use the lambda with different configs from eventbridge like: ``` resource "aws_cloudwatch_event_rule" "pytorch_auto_revert_5m" { name = "pytorch-auto-revert-5m" description = "Every 5 minutes with config A" schedule_expression = "rate(5 minutes)" } resource "aws_cloudwatch_event_target" "pytorch_auto_revert_5m_target" { rule = aws_cloudwatch_event_rule.pytorch_auto_revert_5m.name target_id = "pytorch-auto-revert-5m" arn = aws_lambda_function.pytorch_auto_revert.arn input = jsonencode({ mode = "hud" dry_run = false overrides = { bisection_limit = 10 clickhouse_database = "default" } }) } ``` Key reasonings on the decisions: - created a single class for parsed configs that is distinct from default configs, still allowing validating and maintaining readability and single use (one is default, another is actual); - Reused entry points from lambda and cli, so, mostly if not all, can be fully replicated via cli in case of firefight or debugging; - broken entry point for cli and lambda: one parses opts and dotfiles, another parse eventbridge. Separation of concerns and easier to read; - removed possibility of running without any parameters in CLI to replicate lambda - there will be multiple configurations, so, this does not make sense anymore; --------- Signed-off-by: Jean Schmidt <[email protected]> Co-authored-by: Ivan Zaitsev <[email protected]>
1 parent 7a9babb commit 3e8a3be

File tree

5 files changed

+422
-62
lines changed

5 files changed

+422
-62
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.zip
22
deployment/
33
venv/
4+
*.html

aws/lambda/pytorch-auto-revert/Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ venv/bin/python:
1313
venv/bin/pip install -r requirements.txt
1414

1515
venv/bin/lintrunner: venv/bin/python
16-
venv/bin/pip install lintrunner==0.12.5 boto3-stubs==1.34.51
16+
venv/bin/pip install -r dev_requirements.txt
1717
# lintrunner only works properly with virtualenv if you activate it first
1818
. venv/bin/activate && lintrunner init --config ../../../.lintrunner.toml
1919

20-
.PHONY: run-local
21-
run-local: venv/bin/python
22-
NOTIFY_ISSUE_NUMBER=265 REPO_FULL_NAME=pytorch/pytorch-canary venv/bin/python -m pytorch_auto_revert --dry-run
23-
2420
.PHONY: run-local-workflows
2521
run-local-workflows: venv/bin/python
2622
NOTIFY_ISSUE_NUMBER=265 REPO_FULL_NAME=pytorch/pytorch-canary venv/bin/python -m pytorch_auto_revert --dry-run autorevert-checker Lint trunk pull inductor linux-binary-manywheel --hours 8
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
boto3-stubs>=1.34.51
2+
lintrunner==0.12.5
3+
setuptools>=80.9.0

0 commit comments

Comments
 (0)