diff --git a/redis_benchmarks_specification/__runner__/args.py b/redis_benchmarks_specification/__runner__/args.py index 60a0bc77..632ca723 100644 --- a/redis_benchmarks_specification/__runner__/args.py +++ b/redis_benchmarks_specification/__runner__/args.py @@ -184,6 +184,12 @@ def create_client_runner_args(project_name): type=int, help="override memtier test-time for each benchmark. By default will preserve test time specified in test spec", ) + parser.add_argument( + "--benchmark_local_install", + default=False, + action="store_true", + help="Assume benchmarking tool (e.g. memtier benchmark) is installed locally and execute it without using a docker container.", + ) parser.add_argument( "--override-test-runs", default=1, diff --git a/redis_benchmarks_specification/__runner__/runner.py b/redis_benchmarks_specification/__runner__/runner.py index 0801fba9..444b8c2a 100644 --- a/redis_benchmarks_specification/__runner__/runner.py +++ b/redis_benchmarks_specification/__runner__/runner.py @@ -552,6 +552,7 @@ def process_self_contained_coordinator_stream( test_tls_key, test_tls_cacert, resp_version, + args.benchmark_local_install, password, ) execute_init_commands( @@ -650,32 +651,49 @@ def process_self_contained_coordinator_stream( profiler_frequency, profiler_call_graph_mode, ) - logging.info( - "Using docker image {} as benchmark client image (cpuset={}) with the following args: {}".format( - client_container_image, - client_cpuset_cpus, - benchmark_command_str, - ) - ) + # run the benchmark benchmark_start_time = datetime.datetime.now() - client_container_stdout = docker_client.containers.run( - image=client_container_image, - volumes={ - temporary_dir_client: { - "bind": client_mnt_point, - "mode": "rw", + if args.benchmark_local_install: + logging.info("Running memtier benchmark outside of docker") + benchmark_command_str = "taskset -c " + client_cpuset_cpus + " " + benchmark_command_str + logging.info( + "Running memtier benchmark command {}".format( + benchmark_command_str + ) + ) + stream = os.popen(benchmark_command_str) + client_container_stdout = stream.read() + move_command = "mv {} {}".format( + local_benchmark_output_filename, temporary_dir_client + ) + os.system(move_command) + else: + logging.info( + "Using docker image {} as benchmark client image (cpuset={}) with the following args: {}".format( + client_container_image, + client_cpuset_cpus, + benchmark_command_str, + ) + ) + + client_container_stdout = docker_client.containers.run( + image=client_container_image, + volumes={ + temporary_dir_client: { + "bind": client_mnt_point, + "mode": "rw", + }, }, - }, - auto_remove=True, - privileged=True, - working_dir=benchmark_tool_workdir, - command=benchmark_command_str, - network_mode="host", - detach=False, - cpuset_cpus=client_cpuset_cpus, - ) + auto_remove=True, + privileged=True, + working_dir=benchmark_tool_workdir, + command=benchmark_command_str, + network_mode="host", + detach=False, + cpuset_cpus=client_cpuset_cpus, + ) benchmark_end_time = datetime.datetime.now() benchmark_duration_seconds = ( @@ -969,6 +987,7 @@ def data_prepopulation_step( tls_key=None, tls_cacert=None, resp_version=None, + benchmark_local_install=False, password=None, ): # setup the benchmark @@ -1009,32 +1028,50 @@ def data_prepopulation_step( override_memtier_test_time_preload, ) - logging.info( - "Using docker image {} as benchmark PRELOAD image (cpuset={}) with the following args: {}".format( - preload_image, - client_cpuset_cpus, - preload_command_str, - ) - ) # run the benchmark preload_start_time = datetime.datetime.now() - client_container_stdout = docker_client.containers.run( - image=preload_image, - volumes={ - temporary_dir: { - "bind": client_mnt_point, - "mode": "rw", + if benchmark_local_install: + logging.info("Running memtier benchmark outside of docker") + + preload_command_str = "taskset -c " + client_cpuset_cpus + " " + preload_command_str + logging.info( + "Pre-loading using memtier benchmark command {}".format( + preload_command_str + ) + ) + stream = os.popen(preload_command_str) + client_container_stdout = stream.read() + + move_command = "mv {} {}".format( + local_benchmark_output_filename, temporary_dir + ) + os.system(move_command) + + else: + logging.info( + "Using docker image {} as benchmark PRELOAD image (cpuset={}) with the following args: {}".format( + preload_image, + client_cpuset_cpus, + preload_command_str, + ) + ) + client_container_stdout = docker_client.containers.run( + image=preload_image, + volumes={ + temporary_dir: { + "bind": client_mnt_point, + "mode": "rw", + }, }, - }, - auto_remove=True, - privileged=True, - working_dir=benchmark_tool_workdir, - command=preload_command_str, - network_mode="host", - detach=False, - cpuset_cpus=client_cpuset_cpus, - ) + auto_remove=True, + privileged=True, + working_dir=benchmark_tool_workdir, + command=preload_command_str, + network_mode="host", + detach=False, + cpuset_cpus=client_cpuset_cpus, + ) preload_end_time = datetime.datetime.now() preload_duration_seconds = calculate_client_tool_duration_and_check(