Skip to content

Commit 229bc04

Browse files
committed
PYTHON-5358 - Switch to supported Perf usage in EVG
1 parent cf9b68c commit 229bc04

File tree

4 files changed

+62
-5
lines changed

4 files changed

+62
-5
lines changed

.evergreen/generated_configs/functions.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,23 @@ functions:
162162

163163
# Send dashboard data
164164
send dashboard data:
165-
- command: perf.send
165+
- command: subprocess.exec
166+
params:
167+
binary: bash
168+
args:
169+
- .evergreen/scripts/perf-submission-setup.sh
170+
working_dir: src
171+
type: test
172+
- command: expansions.update
166173
params:
167-
file: src/results.json
174+
file: src/expansion.yml
175+
- command: subprocess.exec
176+
params:
177+
binary: bash
178+
args:
179+
- .evergreen/scripts/perf-submission.sh
180+
working_dir: src
181+
type: test
168182

169183
# Setup system
170184
setup system:

.evergreen/scripts/generate_config.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
ec2_assume_role,
4242
expansions_update,
4343
git_get_project,
44-
perf_send,
4544
)
4645
from shrub.v3.evg_task import EvgTask, EvgTaskDependency, EvgTaskRef
4746

@@ -1103,8 +1102,12 @@ def create_attach_benchmark_test_results_func():
11031102

11041103

11051104
def create_send_dashboard_data_func():
1106-
cmd = perf_send(file="src/results.json")
1107-
return "send dashboard data", [cmd]
1105+
cmds = [
1106+
get_subprocess_exec(args=[".evergreen/scripts/perf-submission-setup.sh"]),
1107+
expansions_update(file="src/expansion.yml"),
1108+
get_subprocess_exec(args=[".evergreen/scripts/perf-submission.sh"]),
1109+
]
1110+
return "send dashboard data", cmds
11081111

11091112

11101113
mod = sys.modules[__name__]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# We use the requester expansion to determine whether the data is from a mainline evergreen run or not
3+
4+
set -eu
5+
6+
# shellcheck disable=SC2154
7+
if [ "${requester}" == "commit" ]; then
8+
echo "is_mainline: true" >> expansion.yml
9+
else
10+
echo "is_mainline: false" >> expansion.yml
11+
fi
12+
13+
# We parse the username out of the order_id as patches append that in and SPS does not need that information
14+
# shellcheck disable=SC2154
15+
echo "parsed_order_id: $(echo "${revision_order_id}" | awk -F'_' '{print $NF}')" >> expansion.yml

.evergreen/scripts/perf-submission.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# We use the requester expansion to determine whether the data is from a mainline evergreen run or not
3+
4+
set -eu
5+
6+
# Submit the performance data to the SPS endpoint
7+
# shellcheck disable=SC2154
8+
response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \
9+
"https://performance-monitoring-api.corp.mongodb.com/raw_perf_results/cedar_report?project=${project_id}&version=${version_id}&variant=${build_variant}&order=${parsed_order_id}&task_name=${task_name}&task_id=${task_id}&execution=${execution}&mainline=${is_mainline}" \
10+
-H 'accept: application/json' \
11+
-H 'Content-Type: application/json' \
12+
-d @performance_results.json)
13+
14+
http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}')
15+
response_body=$(echo "$response" | sed '/HTTP_STATUS/d')
16+
17+
# We want to throw an error if the data was not successfully submitted
18+
if [ "$http_status" -ne 200 ]; then
19+
echo "Error: Received HTTP status $http_status"
20+
echo "Response Body: $response_body"
21+
exit 1
22+
fi
23+
24+
echo "Response Body: $response_body"
25+
echo "HTTP Status: $http_status"

0 commit comments

Comments
 (0)