Skip to content

Commit 1bec234

Browse files
author
Pat
authored
ci: perf test improvements (fluent#5636)
* examples: reduce logging and improve build times Signed-off-by: Patrick Stephens <[email protected]> * workflows: switch to pull_request_target Signed-off-by: Patrick Stephens <[email protected]> * workflows: update to provide output Signed-off-by: Patrick Stephens <[email protected]>
1 parent 937c369 commit 1bec234

File tree

3 files changed

+40
-11
lines changed

3 files changed

+40
-11
lines changed

.github/workflows/pr-perf-test.yaml

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Build and run performance tests for PR
22
on:
3-
pull_request:
3+
# We want to run on forks as we protect with a label.
4+
# Without this we have no secrets to pass.
5+
pull_request_target:
46
branches:
57
- master
68
types:
@@ -21,22 +23,47 @@ jobs:
2123
secrets:
2224
service-account: ${{ secrets.GCP_SA_KEY }}
2325

24-
pr-perf-test-complete:
25-
name: PR - performance test complete
26+
pr-perf-test-upload:
27+
name: PR - performance test upload
28+
if: always()
2629
runs-on: ubuntu-latest
2730
needs:
2831
- pr-perf-test-run
32+
permissions:
33+
pull-requests: write
2934
steps:
3035
- uses: actions/download-artifact@v3
3136

32-
- name: Upload plots
37+
- name: Upload plots to CML
3338
continue-on-error: true
34-
uses: edunad/[email protected]
35-
with:
36-
path: './**/*.png'
37-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
39+
run: |
40+
for FILE in *.png; do
41+
echo "Handling $FILE"
42+
docker run --rm -t \
43+
-v $PWD:/output:rw \
44+
dvcorg/cml-py3:latest \
45+
/bin/sh -c "cml-publish /output/$FILE $DEFAULT_SETTINGS --md --title=$FILE >> /output/report.md"
46+
done
47+
cat report.md
48+
docker run --rm -t \
49+
-v $PWD/report.md:/report.md:ro \
50+
-e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" \
51+
dvcorg/cml-py3:latest \
52+
/bin/sh -c "cml-send-comment /report.md $DEFAULT_SETTINGS --commit-sha=${{ github.sha }}"
53+
shell: bash
54+
working-directory: output
55+
env:
56+
DEFAULT_SETTINGS: "--driver=github --repo=${{ github.repository }}"
3957

58+
pr-perf-test-complete:
59+
# Only runs on success
60+
name: PR - performance test complete
61+
runs-on: ubuntu-latest
62+
needs:
63+
- pr-perf-test-run
64+
permissions:
65+
pull-requests: write
66+
steps:
4067
- uses: actions-ecosystem/action-add-labels@v1
4168
name: Label the PR
4269
with:

examples/perf_test/docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "3"
1+
version: "3.4"
22

33
services:
44

@@ -12,6 +12,7 @@ services:
1212
build:
1313
context: ../..
1414
dockerfile: dockerfiles/Dockerfile
15+
target: production
1516
volumes:
1617
- log-volume:/logs:ro
1718
- ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf:ro

examples/perf_test/scripts/entrypoint.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ do
1717
/scripts/multi-line-log-generator.sh &
1818
else
1919
echo "Creating $OUTPUT_LOGFILE"
20-
/run_log_generator.py --log-size-in-bytes "$LOG_SIZE" --log-rate "$LOG_RATE" --log-agent-input-type tail --tail-file-path "$OUTPUT_LOGFILE" &
20+
# Far too much debug
21+
/run_log_generator.py --log-size-in-bytes "$LOG_SIZE" --log-rate "$LOG_RATE" --log-agent-input-type tail --tail-file-path "$OUTPUT_LOGFILE" &> /dev/null &
2122
fi
2223
done
2324

0 commit comments

Comments
 (0)