From 947f0b23ccea1377a5f08900fe71d7de118e5042 Mon Sep 17 00:00:00 2001 From: Simon Mo Date: Tue, 16 Jan 2024 09:50:13 -0800 Subject: [PATCH] CI: make sure benchmark script exit on error (#2449) --- .buildkite/run-benchmarks.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.buildkite/run-benchmarks.sh b/.buildkite/run-benchmarks.sh index 0a77f09b..c4e6b21d 100644 --- a/.buildkite/run-benchmarks.sh +++ b/.buildkite/run-benchmarks.sh @@ -7,8 +7,10 @@ cd "$(dirname "${BASH_SOURCE[0]}")/.." # run benchmarks and upload the result to buildkite python3 benchmarks/benchmark_latency.py 2>&1 | tee benchmark_latency.txt +bench_latency_exit_code=$? python3 benchmarks/benchmark_throughput.py --input-len 256 --output-len 256 2>&1 | tee benchmark_throughput.txt +bench_throughput_exit_code=$? # write the results into a markdown file echo "### Latency Benchmarks" >> benchmark_results.md @@ -22,3 +24,12 @@ sed -n '$p' benchmark_throughput.txt >> benchmark_results.md # upload the results to buildkite /workspace/buildkite-agent annotate --style "info" --context "benchmark-results" < benchmark_results.md + +# exit with the exit code of the benchmarks +if [ $bench_latency_exit_code -ne 0 ]; then + exit $bench_latency_exit_code +fi + +if [ $bench_throughput_exit_code -ne 0 ]; then + exit $bench_throughput_exit_code +fi