Skip to content

Commit b35b289

Browse files
committed
PYTHON-5513 Use the perfcomp tool on pull requests
1 parent 27ac7bd commit b35b289

File tree

5 files changed

+73
-1
lines changed

5 files changed

+73
-1
lines changed

.evergreen/generated_configs/functions.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@ functions:
8585
params:
8686
directory: src
8787

88+
# Perf comment
89+
create perf comment:
90+
- command: subprocess.exec
91+
params:
92+
binary: bash
93+
args:
94+
- .evergreen/scripts/perf-pr-comment.sh
95+
working_dir: src
96+
include_expansions_in_env:
97+
- version_id
98+
- revision
99+
- github_commit
100+
- project
101+
- TASK_NAME
102+
type: test
103+
88104
# Run server
89105
run server:
90106
- command: subprocess.exec

.evergreen/generated_configs/tasks.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,10 @@ tasks:
23342334
SUB_TEST_NAME: sync
23352335
- func: attach benchmark test results
23362336
- func: send dashboard data
2337-
tags: [perf]
2337+
- func: create perf comment
2338+
vars:
2339+
TASK_NAME: perf-8.0-standalone-ssl
2340+
tags: [perf, pr]
23382341
- name: perf-8.0-standalone-ssl-async
23392342
commands:
23402343
- func: run server

.evergreen/scripts/configure-env.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ EOT
7676
rm -rf $DRIVERS_TOOLS
7777
BRANCH=master
7878
ORG=mongodb-labs
79+
BRANCH=PYTHON-5513
80+
ORG=blink1073
7981
git clone --branch $BRANCH https://github.com/$ORG/drivers-evergreen-tools.git $DRIVERS_TOOLS
8082

8183
cat <<EOT > ${DRIVERS_TOOLS}/.env

.evergreen/scripts/generate_config.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,11 @@ def create_perf_tasks():
934934
task_name += "-async"
935935
tags = ["perf"]
936936
commands = [server_func, test_func, attach_func, send_func]
937+
if ssl == "ssl" and sync == "sync":
938+
tags.append("pr")
939+
comment_vars = dict(TASK_NAME=task_name)
940+
comment_func = FunctionCall(func="create perf comment", vars=comment_vars)
941+
commands.append(comment_func)
937942
tasks.append(EvgTask(name=task_name, tags=tags, commands=commands))
938943
return tasks
939944

@@ -1225,6 +1230,22 @@ def create_send_dashboard_data_func():
12251230
return "send dashboard data", cmds
12261231

12271232

1233+
def create_perf_comment_func():
1234+
includes = [
1235+
"version_id",
1236+
"revision",
1237+
"github_commit",
1238+
"project",
1239+
"TASK_NAME",
1240+
]
1241+
cmds = [
1242+
get_subprocess_exec(
1243+
include_expansions_in_env=includes, args=[".evergreen/scripts/perf-pr-comment.sh"]
1244+
)
1245+
]
1246+
return "create perf comment", cmds
1247+
1248+
12281249
mod = sys.modules[__name__]
12291250
write_variants_to_file(mod)
12301251
write_tasks_to_file(mod)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# Generate a PR comment with the perf report
3+
4+
set -eu
5+
6+
VERSION_ID=${version_id}
7+
BASE_SHA=${revision}
8+
HEAD_SHA=${github_commit}
9+
PROJECT=${project}
10+
11+
if [ "${PROJECT}" != "mongo-python-driver" ]; then
12+
echo "Skipping PR Perf comment"
13+
exit 0
14+
fi
15+
16+
17+
pushd $DRIVERS_TOOLS/.evergreen >/dev/null
18+
CONTEXT="PyMongo triage context" TASK="${TASK_NAME}" VARIANT="performance-benchmarks" sh run-perf-comp.sh
19+
20+
if [[ -n "${BASE_SHA+set}" && -n "${HEAD_SHA+set}" && "$BASE_SHA" != "$HEAD_SHA" ]]; then
21+
# Make the PR comment.
22+
target=github_app/create_or_modify_comment.sh
23+
bash $target -m "## 🧪 Performance Results" -c "$(pwd)/perfcomp/perf-report.md" -h $HEAD_SHA -o "mongodb" -n $PROJECT
24+
rm ./perfcomp/perf-report.md
25+
else
26+
# Skip comment if it isn't a PR run.
27+
echo "Skipping Perf PR comment"
28+
fi
29+
30+
popd >/dev/null

0 commit comments

Comments
 (0)