From 8aebc1336b8b94b3e53db87b59156406db1c912a Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Sun, 26 May 2024 19:23:14 +0200 Subject: [PATCH] wip --- .github/workflows/osrm-backend.yml | 28 +++++++++---------- ...py => process_locust_benchmark_results.py} | 10 +++---- scripts/ci/run_benchmarks.sh | 5 ++-- 3 files changed, 22 insertions(+), 21 deletions(-) rename scripts/ci/{process_locust_benchmark.py => process_locust_benchmark_results.py} (78%) diff --git a/.github/workflows/osrm-backend.yml b/.github/workflows/osrm-backend.yml index 53b65d8de..990012334 100644 --- a/.github/workflows/osrm-backend.yml +++ b/.github/workflows/osrm-backend.yml @@ -660,20 +660,20 @@ jobs: make -j$(nproc) benchmarks cd .. make -C test/data - # - name: Checkout Base Branch - # uses: actions/checkout@v4 - # with: - # ref: ${{ github.event.pull_request.base.ref }} - # path: base - # - name: Build Base Branch - # run: | - # mkdir base/build - # cd base/build - # cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release .. - # make -j$(nproc) - # make -j$(nproc) benchmarks - # cd .. - # make -C test/data + - name: Checkout Base Branch + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.base.ref }} + path: base + - name: Build Base Branch + run: | + mkdir base/build + cd base/build + cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release .. + make -j$(nproc) + make -j$(nproc) benchmarks + cd .. + make -C test/data - name: Run Benchmarks run: | ./pr/scripts/ci/run_benchmarks.sh base pr diff --git a/scripts/ci/process_locust_benchmark.py b/scripts/ci/process_locust_benchmark_results.py similarity index 78% rename from scripts/ci/process_locust_benchmark.py rename to scripts/ci/process_locust_benchmark_results.py index b495455be..999838d8e 100644 --- a/scripts/ci/process_locust_benchmark.py +++ b/scripts/ci/process_locust_benchmark_results.py @@ -1,13 +1,13 @@ import sys import csv -def check_csv_is_empty(file_path): +def csv_is_empty(file_path): with open(file_path, 'r') as file: lines = file.readlines() return len(lines) <= 1 def main(locust_csv_base_name, prefix, output_folder): - if not check_csv_is_empty(f"{locust_csv_base_name}_exceptions.csv") or not check_csv_is_empty(f"{locust_csv_base_name}_failures"): + if not csv_is_empty(f"{locust_csv_base_name}_exceptions.csv") or not csv_is_empty(f"{locust_csv_base_name}_failures.csv"): raise Exception("There are exceptions or failures in the locust benchmark") with open(f"{locust_csv_base_name}_stats.csv", 'r') as file: @@ -17,9 +17,9 @@ def main(locust_csv_base_name, prefix, output_folder): if name == 'Aggregated': continue statistics = f''' -Request Count: {row['Request Count']} -Requests/s: {row['Requests/s']}req/s -Failures/s: {row['Failures/s']}fail/s +requests: {row['Request Count']} +req/s: {row['Requests/s']}req/s +fail/s: {row['Failures/s']}fail/s avg: {row['Average Response Time']}ms 50%: {row['50%']} 75%: {row['75%']}ms diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index 022173a10..bc1a58b25 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -34,6 +34,7 @@ function run_benchmarks_for_folder { $BINARIES_FOLDER/osrm-routed --algorithm mld $FOLDER/data.osrm & OSRM_ROUTED_PID=$! + # wait for osrm-routed to start curl --retry-delay 3 --retry 10 --retry-all-errors "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true" locust -f $FOLDER/scripts/ci/locustfile.py \ --headless \ @@ -45,13 +46,13 @@ function run_benchmarks_for_folder { --csv=locust_results \ --loglevel ERROR - python3 $FOLDER/scripts/ci/process_locust_results.py locust_results mld $RESULTS_FOLDER + python3 $FOLDER/scripts/ci/process_locust_benchmark_results.py locust_results mld $RESULTS_FOLDER kill -0 $OSRM_ROUTED_PID fi } -# run_benchmarks_for_folder $1 "${1}_results" +run_benchmarks_for_folder $1 "${1}_results" run_benchmarks_for_folder $2 "${2}_results"