save daily perf results (#7396)

It's a real shame I forgot to do this sooner, but better late than never
I suppose.

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Gary Verhaegen 2020-09-14 20:38:31 +02:00 committed by GitHub
parent d966178f47
commit b2d58a3304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 16 deletions

View File

@ -712,10 +712,14 @@ jobs:
pr.num: $[ variables['System.PullRequest.PullRequestNumber'] ]
pr.branch: $[ variables['System.PullRequest.SourceBranch'] ]
steps:
- template: ci/bash-lib.yml
parameters:
var_name: bash_lib
- bash: |
set -euo pipefail
eval "$(./dev-env/bin/dade-assist)"
source $(bash_lib)
REPORT=$(mktemp)
cat >$REPORT <<END
@ -772,22 +776,14 @@ jobs:
cat $REPORT | jq '.'
REPORT_GZ=$(mktemp)
cat $REPORT | gzip -9 > $REPORT_GZ
GCS_KEY=$(mktemp)
cleanup() {
rm -rf $GCS_KEY
}
trap cleanup EXIT
# Application credentials will not be set for forks. We give up on
# tracking those for now. "Not set" in Azure world means set to the
# expression Azure would otherwise substitute, i.e. the literal value
# of the string in the `env:` block below.
if [[ "${GOOGLE_APPLICATION_CREDENTIALS_CONTENT:1:${#GOOGLE_APPLICATION_CREDENTIALS_CONTENT}-1}" != '(GOOGLE_APPLICATION_CREDENTIALS_CONTENT)' ]]; then
echo "$GOOGLE_APPLICATION_CREDENTIALS_CONTENT" > $GCS_KEY
gcloud auth activate-service-account --key-file=$GCS_KEY
BOTO_CONFIG=/dev/null gsutil cp $REPORT_GZ gs://daml-data/builds/$(Build.BuildId)_$(date -u +%Y%m%d_%H%M%SZ).json.gz
if [[ "${GCRED:1:${#GCRED}-1}" != '(GOOGLE_APPLICATION_CREDENTIALS_CONTENT)' ]]; then
save_gcp_data "$GCRED" "$REPORT_GZ" "gs://daml-data/builds/$(Build.BuildId)_$(date -u +%Y%m%d_%H%M%SZ).json.gz"
else
echo "Could not save build data: no credentials. Data was:"
cat $REPORT
echo "Could not save build data: no credentials."
fi
# Linux, macOS and Windows are always required and should always
@ -806,7 +802,7 @@ jobs:
exit 1
fi
env:
GOOGLE_APPLICATION_CREDENTIALS_CONTENT: $(GOOGLE_APPLICATION_CREDENTIALS_CONTENT)
GCRED: $(GOOGLE_APPLICATION_CREDENTIALS_CONTENT)
# Commit message is always set
COMMIT_MSG: $(Build.SourceVersionMessage)
# Because these variables are always set (in the variables block),

View File

@ -29,5 +29,25 @@ steps:
jq -n --arg message "$message" '{"text": $message}' \
| curl -XPOST -i -H 'Content-Type: application/json' -d @- $channel
}
save_gcp_data() {
local restore_trap cred local_file remote_path key cleanup
cred="$1"
local_file="$2"
remote_path="$3"
key=$(mktemp)
# There may already be a trap; this will save it
restore_trap=$(trap -p EXIT)
cleanup="rm -rf $key ~/.config/gcloud"
trap "$cleanup" EXIT
echo "$cred" > $key
gcloud auth activate-service-account --key-file=$key
BOTO_CONFIG=/dev/null gsutil cp "$local_file" "$remote_path"
eval "$cleanup"
trap - EXIT
eval "$restore_trap"
}
END
echo "##vso[task.setvariable variable=${{parameters.var_name}}]$TMP"

View File

@ -69,7 +69,7 @@ jobs:
artifactName: 'Bazel Compatibility Logs'
- template: ../daily_tell_slack.yml
- job: performance_report
- job: perf_speedy
timeoutInMinutes: 120
pool:
name: "linux-pool"
@ -84,22 +84,35 @@ jobs:
IS_FORK: $(System.PullRequest.IsFork)
# to upload to the bazel cache
GOOGLE_APPLICATION_CREDENTIALS_CONTENT: $(GOOGLE_APPLICATION_CREDENTIALS_CONTENT)
- template: ../bash-lib.yml
parameters:
var_name: bash_lib
- bash: |
set -euo pipefail
eval "$(dev-env/bin/dade assist)"
source $(bash_lib)
BASELINE="cebc26af88efef4a7c81c62b0c14353f829b755e"
TEST_SHA=$(cat ci/cron/perf/test_sha)
OUT="$(Build.StagingDirectory)/perf-results.json"
START=$(date -u +%Y%m%d_%H%M%SZ)
if git diff --exit-code $TEST_SHA -- daml-lf/scenario-interpreter/src/perf >&2; then
# no changes, all good
ci/cron/perf/compare.sh $BASELINE > $OUT
cat $(Build.StagingDirectory)/perf-results.json
ci/cron/perf/compare.sh $BASELINE > "$OUT"
cat "$OUT"
else
# the tests have changed, we need to figure out what to do with
# the baseline.
echo "Baseline no longer valid, needs manual correction." > $OUT
echo "Baseline no longer valid, needs manual correction." > "$OUT"
fi
save_gcp_data "$GCRED" "$OUT" gs://daml-data/perf/speedy/$START.json
displayName: measure perf
env:
GCRED: $(GOOGLE_APPLICATION_CREDENTIALS_CONTENT)
- template: ../daily_tell_slack.yml
parameters:
success-message: '$(cat $(Build.StagingDirectory)/perf-results.json | jq . | jq -sR ''"perf for ''"$COMMIT_LINK"'':```\(.)```"'')'