From 71cb9d7bcdb5f4891296f6ca76e15f9757987681 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Sun, 26 May 2024 20:56:54 +0200 Subject: [PATCH] wip --- scripts/ci/locustfile.py | 26 +++++++++---------- .../ci/process_locust_benchmark_results.py | 10 +++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/ci/locustfile.py b/scripts/ci/locustfile.py index 60d18ce75..57053a4ec 100644 --- a/scripts/ci/locustfile.py +++ b/scripts/ci/locustfile.py @@ -30,22 +30,22 @@ class OSRMTasks(TaskSet): self.client.get(f"/route/v1/driving/{start_coord};{end_coord}?overview=full&steps=true", name="driving") - # @task - # def get_table(self): - # num_coords = random.randint(3, 50) - # 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, 50) + 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}", name="table") + self.client.get(f"/table/v1/driving/{coords_str}", name="table") - # @task - # def get_match(self): - # num_coords = random.randint(3, 50) - # track_id = random.choice(self.track_ids) - # track_coords = self.tracks[track_id][:num_coords] - # coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in track_coords]) + @task + def get_match(self): + num_coords = random.randint(3, 50) + track_id = random.choice(self.track_ids) + track_coords = self.tracks[track_id][:num_coords] + 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", name="match") + self.client.get(f"/match/v1/driving/{coords_str}?steps=true", name="match") @task def get_nearest(self): diff --git a/scripts/ci/process_locust_benchmark_results.py b/scripts/ci/process_locust_benchmark_results.py index a425ff7cc..588e770da 100644 --- a/scripts/ci/process_locust_benchmark_results.py +++ b/scripts/ci/process_locust_benchmark_results.py @@ -24,15 +24,15 @@ def main(locust_csv_base_name, prefix, output_folder): statistics = f''' 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%']} +req/s: {float(row['Requests/s']):.3f}req/s +fail/s: {float(row['Failures/s']):.3f}fail/s +avg: {float(row['Average Response Time']):.3f}ms +50%: {row['50%']}ms 75%: {row['75%']}ms 95%: {row['95%']}ms 98%: {row['98%']}ms 99%: {row['99%']}ms -max: {row['Max Response Time']}ms +max: {float(row['Max Response Time']):.3f}ms ''' with open(f"{output_folder}/{prefix}_{name}.bench", 'w') as f: print(f"Writing statistics to {output_folder}/{prefix}_{name}.bench")