Skip to content

Commit

Permalink
Reformat files
Browse files Browse the repository at this point in the history
  • Loading branch information
mpozniak95 committed Dec 11, 2024
1 parent f8cd5b3 commit 406c29f
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 35 deletions.
5 changes: 4 additions & 1 deletion redis_benchmarks_specification/__builder__/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,10 @@ def generate_benchmark_stream_request(
for artifact in build_artifacts:
bin_key = f"zipped:artifacts:{prefix}:{id}:{artifact}.zip"
if artifact == "redisearch.so":
bin_artifact = open(f"{redis_temporary_dir}modules/redisearch/src/bin/linux-x64-release/search-community/{artifact}", "rb").read()
bin_artifact = open(
f"{redis_temporary_dir}modules/redisearch/src/bin/linux-x64-release/search-community/{artifact}",
"rb",
).read()
else:
bin_artifact = open(f"{redis_temporary_dir}src/{artifact}", "rb").read()
bin_artifact_len = len(bytes(bin_artifact))
Expand Down
26 changes: 13 additions & 13 deletions redis_benchmarks_specification/__runner__/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,30 +203,31 @@ def run_client_runner_logic(args, project_name, project_name_suffix, project_ver
override_memtier_test_time,
)


def prepare_vector_db_benchmark_parameters(
clientconfig,
full_benchmark_path,
port,
server,
password,
client_mnt_point
clientconfig, full_benchmark_path, port, server, password, client_mnt_point
):
benchmark_command = []
# if port is not None:
# benchmark_command.extend(["REDIS_PORT={}".format(port)])
# if password is not None:
# benchmark_command.extend(["REDIS_AUTH={}".format(password)])
benchmark_command.extend([
full_benchmark_path,
"--host",
f"{server}",
])
benchmark_command.extend(
[
full_benchmark_path,
"--host",
f"{server}",
]
)
benchmark_command.extend(["--engines", clientconfig.get("engines", "redis-test")])
benchmark_command.extend(["--datasets", clientconfig.get("datasets", "glove-100-angular")])
benchmark_command.extend(
["--datasets", clientconfig.get("datasets", "glove-100-angular")]
)
benchmark_command_str = " ".join(benchmark_command)
benchmark_command_str = f"bash -c 'ITERATIONS=1 {benchmark_command_str} && mv /code/results {client_mnt_point}.'"
return None, benchmark_command_str


def prepare_memtier_benchmark_parameters(
clientconfig,
full_benchmark_path,
Expand Down Expand Up @@ -771,7 +772,6 @@ def delete_temporary_files(
False,
)


if (
arbitrary_command
and oss_cluster_api_enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ def prepare_vector_db_benchmark_parameters(
benchmark_command = []
if port is not None:
benchmark_command.extend(["REDIS_PORT={}".format(port)])
benchmark_command.extend([
full_benchmark_path,
"--host",
f"{server}",
])
benchmark_command.extend(["--engines", clientconfig.get("engines", "redis-m-8-ef-16")])
benchmark_command.extend(["--datasets", clientconfig.get("datasets", "glove-100-angular")])
benchmark_command.extend(
[
full_benchmark_path,
"--host",
f"{server}",
]
)
benchmark_command.extend(
["--engines", clientconfig.get("engines", "redis-m-8-ef-16")]
)
benchmark_command.extend(
["--datasets", clientconfig.get("datasets", "glove-100-angular")]
)
benchmark_command_str = " ".join(benchmark_command)
return None, benchmark_command_str
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import os
import json


def post_process_vector_db(temporary_dir):
results_dir = os.path.join(temporary_dir, 'results')
results_dir = os.path.join(temporary_dir, "results")
results = {}
for file in os.listdir(results_dir):
if "upload" in file:
with open(os.path.join(results_dir, file), 'r') as f:
with open(os.path.join(results_dir, file), "r") as f:
upload_results = json.load(f)
results['upload_time'] = upload_results['results']['upload_time']
results["upload_time"] = upload_results["results"]["upload_time"]
else:
with open(os.path.join(results_dir, file), 'r') as f:
with open(os.path.join(results_dir, file), "r") as f:
query_results = json.load(f)
results['rps'] = query_results['results']['rps']
results['precision'] = query_results['results']['mean_precisions']
results['total_time'] = query_results['results']['total_time']
results["rps"] = query_results["results"]["rps"]
results["precision"] = query_results["results"]["mean_precisions"]
results["total_time"] = query_results["results"]["total_time"]
return results
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ def process_self_contained_coordinator_stream(
False,
)


client_container_image = extract_client_container_image(
benchmark_config
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
import time

from docker.models.containers import Container
from redis_benchmarks_specification.__self_contained_coordinator__.post_processing import post_process_vector_db
from redis_benchmarks_specification.__self_contained_coordinator__.post_processing import (
post_process_vector_db,
)
from redisbench_admin.profilers.profilers_local import (
check_compatible_system_and_kernel_and_prepare_profile,
)
Expand Down Expand Up @@ -1025,7 +1027,7 @@ def process_self_contained_coordinator_stream(
"mode": "rw",
},
},
#auto_remove=True,
auto_remove=True,
privileged=True,
working_dir=benchmark_tool_workdir,
command=benchmark_command_str,
Expand All @@ -1034,8 +1036,16 @@ def process_self_contained_coordinator_stream(
cpuset_cpus=client_cpuset_cpus,
)
except docker.errors.ContainerError as e:
logging.info("stdout: {}".format(e.container.logs(stdout=True)))
logging.info("stderr: {}".format(e.container.logs(stderr=True)))
logging.info(
"stdout: {}".format(
e.container.logs(stdout=True)
)
)
logging.info(
"stderr: {}".format(
e.container.logs(stderr=True)
)
)
raise e

benchmark_end_time = datetime.datetime.now()
Expand Down Expand Up @@ -1159,8 +1169,12 @@ def process_self_contained_coordinator_stream(
):
datapoint_time_ms = git_timestamp_ms
if "vector_db_benchmark" in benchmark_tool:
print(f"Debug: Post-processing vector-db-benchmark results")
results_dict = post_process_vector_db(temporary_dir_client)
print(
f"Debug: Post-processing vector-db-benchmark results"
)
results_dict = post_process_vector_db(
temporary_dir_client
)
print(f"Debug: results: {results_dict}")
else:
post_process_benchmark_results(
Expand Down

0 comments on commit 406c29f

Please sign in to comment.