Skip to content

Commit 0f66519

Browse files
authored
Make lambda pass the bot managment (#7509)
learned from the job_utilization attacker lol, this is a way to allow me to call the hud api in lambda
1 parent ccc4096 commit 0f66519

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

aws/lambda/benchmark_regression_summary_report/common/benchmark_time_series_api_model.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,18 @@ def from_request(
6060
requests.exceptions.RequestException if network/timeout/HTTP error
6161
RuntimeError if the API returns an "error" field or malformed data
6262
"""
63-
resp = requests.post(url, json=query, timeout=timeout)
63+
64+
headers = {
65+
# Looks like a real browser instead of python-requests
66+
"User-Agent": (
67+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
68+
"AppleWebKit/537.36 (KHTML, like Gecko) "
69+
"Chrome/120.0.0.0 Safari/537.36"
70+
),
71+
"Accept": "application/json,text/html;q=0.9,*/*;q=0.8",
72+
"Accept-Language": "en-US,en;q=0.9",
73+
}
74+
resp = requests.post(url, json=query, timeout=timeout, headers=headers)
6475
resp.raise_for_status()
6576
payload = resp.json()
6677

aws/lambda/benchmark_regression_summary_report/common/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
hud_info={
9090
"url": "https://hud.pytorch.org/benchmark/v3/dashboard/torchao_micro_api_benchmark",
9191
},
92-
# set baseline from past 3-6 days, and compare with the lastest 4 day
92+
# set baseline from past 3-6 days, and compare with the lastest 3 days
9393
policy=Policy(
9494
frequency=Frequency(value=1, unit="days"),
9595
range=RangeConfig(
@@ -141,6 +141,7 @@
141141
"branches": ["main"],
142142
"repo": "pytorch/pytorch",
143143
"device": "",
144+
"arch": "",
144145
"benchmarkName": "PyTorch operator microbenchmark",
145146
"startTime": "{{ startTime }}",
146147
"stopTime": "{{ stopTime }}"
@@ -152,7 +153,7 @@
152153
hud_info={
153154
"url": "https://hud.pytorch.org/benchmark/v3/dashboard/pytorch_operator_microbenchmark",
154155
},
155-
# set baseline from past 3-6 days, and compare with the lastest 4 day
156+
# set baseline from past 3-6 days, and compare with the lastest 3 day
156157
policy=Policy(
157158
frequency=Frequency(value=1, unit="days"),
158159
range=RangeConfig(

0 commit comments

Comments
 (0)