From feafb25f8f01c57995431d88bd3da97960c766a7 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Sun, 26 May 2024 18:07:30 +0200 Subject: [PATCH] wip --- locustfile.py => scripts/ci/locustfile.py | 36 +++++++++++------------ scripts/ci/run_benchmarks.sh | 11 +++---- 2 files changed, 24 insertions(+), 23 deletions(-) rename locustfile.py => scripts/ci/locustfile.py (59%) diff --git a/locustfile.py b/scripts/ci/locustfile.py similarity index 59% rename from locustfile.py rename to scripts/ci/locustfile.py index aaa451297..d7a4123f3 100644 --- a/locustfile.py +++ b/scripts/ci/locustfile.py @@ -30,21 +30,21 @@ class OSRMTasks(TaskSet): self.client.get(f"/route/v1/driving/{start_coord};{end_coord}?overview=full&steps=true") - @task - def get_table(self): - num_coords = random.randint(3, 500) - selected_coords = random.sample(self.coordinates, num_coords) - coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords]) + # @task + # def get_table(self): + # num_coords = random.randint(3, 500) + # selected_coords = random.sample(self.coordinates, num_coords) + # coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords]) - self.client.get(f"/table/v1/driving/{coords_str}") + # self.client.get(f"/table/v1/driving/{coords_str}") - @task - def get_match(self): - track_id = random.choice(self.track_ids) - track_coords = self.tracks[track_id] - coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in track_coords]) + # @task + # def get_match(self): + # track_id = random.choice(self.track_ids) + # track_coords = self.tracks[track_id] + # coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in track_coords]) - self.client.get(f"/match/v1/driving/{coords_str}?steps=true") + # self.client.get(f"/match/v1/driving/{coords_str}?steps=true") @task def get_nearest(self): @@ -53,13 +53,13 @@ class OSRMTasks(TaskSet): self.client.get(f"/nearest/v1/driving/{coord_str}") - @task - def get_trip(self): - num_coords = random.randint(2, 10) - selected_coords = random.sample(self.coordinates, num_coords) - coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords]) + # @task + # def get_trip(self): + # num_coords = random.randint(2, 10) + # selected_coords = random.sample(self.coordinates, num_coords) + # coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords]) - self.client.get(f"/trip/v1/driving/{coords_str}?steps=true") + # self.client.get(f"/trip/v1/driving/{coords_str}?steps=true") class OSRMUser(HttpUser): tasks = [OSRMTasks] diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index 6f16893f3..6a40aa6b0 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -27,14 +27,15 @@ function run_benchmarks_for_folder { $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm - $BINARIES_FOLDER/osrm-routed --algorithm mld $FOLDER/data.osrm & - OSRM_ROUTED_PID=$! - + $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm # TODO: save results - if [ -f "$FOLDER/locustfile.py" ]; then + if [ -f "$FOLDER/scripts/ci/locustfile.py" ]; then + $BINARIES_FOLDER/osrm-routed --algorithm mld $FOLDER/data.osrm & + OSRM_ROUTED_PID=$! + 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/locustfile.py --headless --users 10 --spawn-rate 1 --host http://localhost:5000 --run-time 1m --csv=results + locust -f $FOLDER/scripts/ci/locustfile.py --headless --users 10 --spawn-rate 1 --host http://localhost:5000 --run-time 1m --csv=results --loglevel ERROR echo "STATS: " cat results_stats.csv