Skip to content

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

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 3 commits into from
May 6, 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
40 changes: 38 additions & 2 deletions .evergreen/generated_configs/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,45 @@ functions:

# Send dashboard data
send dashboard data:
- command: perf.send
- command: subprocess.exec
params:
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/results.json
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:
Expand Down
25 changes: 22 additions & 3 deletions .evergreen/scripts/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
ec2_assume_role,
expansions_update,
git_get_project,
perf_send,
)
from shrub.v3.evg_task import EvgTask, EvgTaskDependency, EvgTaskRef

Expand Down Expand Up @@ -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__]
Expand Down
15 changes: 15 additions & 0 deletions .evergreen/scripts/perf-submission-setup.sh
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions .evergreen/scripts/perf-submission.sh
Original file line number Diff line number Diff line change
@@ -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"
10 changes: 9 additions & 1 deletion test/performance/async_perf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,15 @@ async def asyncTearDown(self):
},
},
"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",
},
},
],
}
)
Expand Down
10 changes: 9 additions & 1 deletion test/performance/perf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,15 @@ def tearDown(self):
},
},
"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",
},
},
],
}
)
Expand Down
Loading