PYTHON-5358 - Switch to supported Perf usage in EVG (#2334)

This commit is contained in:
Noah Stapp 2025-05-06 09:00:30 -04:00 committed by GitHub
parent cf9b68c6f4
commit b0667b11d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 118 additions and 7 deletions

View File

@ -162,9 +162,45 @@ functions:
# Send dashboard data
send dashboard data:
- command: perf.send
- command: subprocess.exec
params:
file: src/results.json
binary: bash
args:
- .evergreen/scripts/perf-submission-setup.sh
working_dir: src
include_expansions_in_env:
- requester
- revision_order_id
- project_id
- version_id
- build_variant
- parsed_order_id
- task_name
- task_id
- execution
- is_mainline
type: test
- command: expansions.update
params:
file: src/expansion.yml
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/scripts/perf-submission.sh
working_dir: src
include_expansions_in_env:
- requester
- revision_order_id
- project_id
- version_id
- build_variant
- parsed_order_id
- task_name
- task_id
- execution
- is_mainline
type: test
# Setup system
setup system:

View File

@ -41,7 +41,6 @@ from shrub.v3.evg_command import (
ec2_assume_role,
expansions_update,
git_get_project,
perf_send,
)
from shrub.v3.evg_task import EvgTask, EvgTaskDependency, EvgTaskRef
@ -1103,8 +1102,28 @@ def create_attach_benchmark_test_results_func():
def create_send_dashboard_data_func():
cmd = perf_send(file="src/results.json")
return "send dashboard data", [cmd]
includes = [
"requester",
"revision_order_id",
"project_id",
"version_id",
"build_variant",
"parsed_order_id",
"task_name",
"task_id",
"execution",
"is_mainline",
]
cmds = [
get_subprocess_exec(
include_expansions_in_env=includes, args=[".evergreen/scripts/perf-submission-setup.sh"]
),
expansions_update(file="src/expansion.yml"),
get_subprocess_exec(
include_expansions_in_env=includes, args=[".evergreen/scripts/perf-submission.sh"]
),
]
return "send dashboard data", cmds
mod = sys.modules[__name__]

View File

@ -0,0 +1,15 @@
#!/bin/bash
# We use the requester expansion to determine whether the data is from a mainline evergreen run or not
set -eu
# shellcheck disable=SC2154
if [ "${requester}" == "commit" ]; then
echo "is_mainline: true" >> expansion.yml
else
echo "is_mainline: false" >> expansion.yml
fi
# We parse the username out of the order_id as patches append that in and SPS does not need that information
# shellcheck disable=SC2154
echo "parsed_order_id: $(echo "${revision_order_id}" | awk -F'_' '{print $NF}')" >> expansion.yml

View File

@ -0,0 +1,25 @@
#!/bin/bash
# We use the requester expansion to determine whether the data is from a mainline evergreen run or not
set -eu
# Submit the performance data to the SPS endpoint
# shellcheck disable=SC2154
response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \
"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}" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d @results.json)
http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}')
response_body=$(echo "$response" | sed '/HTTP_STATUS/d')
# We want to throw an error if the data was not successfully submitted
if [ "$http_status" -ne 200 ]; then
echo "Error: Received HTTP status $http_status"
echo "Response Body: $response_body"
exit 1
fi
echo "Response Body: $response_body"
echo "HTTP Status: $http_status"

View File

@ -144,7 +144,15 @@ class PerformanceTest:
},
},
"metrics": [
{"name": "megabytes_per_sec", "type": "MEDIAN", "value": megabytes_per_sec},
{
"name": "megabytes_per_sec",
"type": "MEDIAN",
"value": megabytes_per_sec,
"metadata": {
"improvement_direction": "up",
"measurement_unit": "megabytes_per_second",
},
},
],
}
)

View File

@ -151,7 +151,15 @@ class PerformanceTest:
},
},
"metrics": [
{"name": "megabytes_per_sec", "type": "MEDIAN", "value": megabytes_per_sec},
{
"name": "megabytes_per_sec",
"type": "MEDIAN",
"value": megabytes_per_sec,
"metadata": {
"improvement_direction": "up",
"measurement_unit": "megabytes_per_second",
},
},
],
}
)