Skip to content
Draft
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
20 changes: 20 additions & 0 deletions .evergreen/generated_configs/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ functions:
params:
directory: src

# Perf comment
create perf comment:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/scripts/perf-pr-comment.sh
working_dir: src
include_expansions_in_env:
- version_id
- revision
- github_commit
- project
- TASK_NAME
- DRIVERS_TOOLS
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_SESSION_TOKEN
type: test

# Run server
run server:
- command: subprocess.exec
Expand Down
6 changes: 5 additions & 1 deletion .evergreen/generated_configs/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,11 @@ tasks:
SUB_TEST_NAME: sync
- func: attach benchmark test results
- func: send dashboard data
tags: [perf]
- func: assume ec2 role
- func: create perf comment
vars:
TASK_NAME: perf-8.0-standalone-ssl
tags: [perf, pr]
- name: perf-8.0-standalone-ssl-async
commands:
- func: run server
Expand Down
2 changes: 2 additions & 0 deletions .evergreen/scripts/configure-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ EOT
rm -rf $DRIVERS_TOOLS
BRANCH=master
ORG=mongodb-labs
BRANCH=PYTHON-5513
ORG=blink1073
git clone --branch $BRANCH https://github.com/$ORG/drivers-evergreen-tools.git $DRIVERS_TOOLS

cat <<EOT > ${DRIVERS_TOOLS}/.env
Expand Down
26 changes: 26 additions & 0 deletions .evergreen/scripts/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,12 @@ def create_perf_tasks():
task_name += "-async"
tags = ["perf"]
commands = [server_func, test_func, attach_func, send_func]
if ssl == "ssl" and sync == "sync":
tags.append("pr")
assume_func = FunctionCall(func="assume ec2 role")
comment_vars = dict(TASK_NAME=task_name)
comment_func = FunctionCall(func="create perf comment", vars=comment_vars)
commands.extend([assume_func, comment_func])
tasks.append(EvgTask(name=task_name, tags=tags, commands=commands))
return tasks

Expand Down Expand Up @@ -1249,6 +1255,26 @@ def create_send_dashboard_data_func():
return "send dashboard data", cmds


def create_perf_comment_func():
includes = [
"version_id",
"revision",
"github_commit",
"project",
"TASK_NAME",
"DRIVERS_TOOLS",
"AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY",
"AWS_SESSION_TOKEN",
]
cmds = [
get_subprocess_exec(
include_expansions_in_env=includes, args=[".evergreen/scripts/perf-pr-comment.sh"]
)
]
return "create perf comment", cmds


mod = sys.modules[__name__]
write_variants_to_file(mod)
write_tasks_to_file(mod)
Expand Down
31 changes: 31 additions & 0 deletions .evergreen/scripts/perf-pr-comment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# Generate a PR comment with the perf report
#shellcheck disable=SC2154

set -eu

export VERSION_ID=${version_id}
export BASE_SHA=${revision}
export HEAD_SHA=${github_commit}
export PROJECT=${project}

if [ "${PROJECT}" != "mongo-python-driver" ]; then
echo "Skipping PR Perf comment"
exit 0
fi


pushd $DRIVERS_TOOLS/.evergreen >/dev/null
CONTEXT="PyMongo triage context" TASK="${TASK_NAME}" VARIANT="performance-benchmarks" sh run-perf-comp.sh

if [[ -n "${BASE_SHA+set}" && -n "${HEAD_SHA+set}" && "$BASE_SHA" != "$HEAD_SHA" ]]; then
# Make the PR comment.
target=github_app/create_or_modify_comment.sh
bash $target -m "## 🧪 Performance Results" -c "$(pwd)/perfcomp/perf-report.md" -h $HEAD_SHA -o "mongodb" -n $PROJECT
rm ./perfcomp/perf-report.md
else
# Skip comment if it isn't a PR run.
echo "Skipping Perf PR comment"
fi

popd >/dev/null
Loading