diff --git a/pyproject.toml b/pyproject.toml index e9b6219..39e20f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "redis-benchmarks-specification" -version = "0.1.215" +version = "0.1.216" description = "The Redis benchmarks specification describes the cross-language/tools requirements and expectations to foster performance and observability standards around redis related technologies. Members from both industry and academia, including organizations and individuals are encouraged to contribute." authors = ["filipecosta90 ","Redis Performance Group "] readme = "Readme.md" diff --git a/redis_benchmarks_specification/__builder__/builder.py b/redis_benchmarks_specification/__builder__/builder.py index a38b635..678a71d 100644 --- a/redis_benchmarks_specification/__builder__/builder.py +++ b/redis_benchmarks_specification/__builder__/builder.py @@ -343,6 +343,8 @@ def builder_process_stream( "linenoise", "lua", ] + if "fast_float" in deps_dir: + deps_list.append("fast_float") if "hdr_histogram" in deps_dir: deps_list.append("hdr_histogram") if "fpconv" in deps_dir: diff --git a/redis_benchmarks_specification/__cli__/cli.py b/redis_benchmarks_specification/__cli__/cli.py index 67bf21e..2baddd4 100644 --- a/redis_benchmarks_specification/__cli__/cli.py +++ b/redis_benchmarks_specification/__cli__/cli.py @@ -87,6 +87,23 @@ def trigger_tests_dockerhub_cli_command_logic(args, project_name, project_versio args.build_arch, testDetails, "n/a", + [], + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ".*", + 0, + 10000, + args.tests_regexp, ) build_stream_fields["github_repo"] = args.gh_repo build_stream_fields["github_org"] = args.gh_org diff --git a/redis_benchmarks_specification/__self_contained_coordinator__/docker.py b/redis_benchmarks_specification/__self_contained_coordinator__/docker.py index ca3e9f6..ea35d6b 100644 --- a/redis_benchmarks_specification/__self_contained_coordinator__/docker.py +++ b/redis_benchmarks_specification/__self_contained_coordinator__/docker.py @@ -20,7 +20,7 @@ def generate_standalone_redis_server_args( "{}".format(port), ] if dbdir != "": - command.extend(["--dbdir", dbdir]) + command.extend(["--dir", dbdir]) if configuration_parameters is not None: for parameter, parameter_value in configuration_parameters.items(): if parameter not in added_params: diff --git a/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py b/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py index 3b7f48d..42d77bf 100644 --- a/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py +++ b/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py @@ -832,39 +832,16 @@ def process_self_contained_coordinator_stream( db_cpuset_cpus, current_cpu_pos = generate_cpuset_cpus( ceil_db_cpu_limit, current_cpu_pos ) - logging.info( - "Running redis-server on docker image {} (cpuset={}) with the following args: {}".format( - run_image, db_cpuset_cpus, command_str - ) - ) - volumes = {} - working_dir = "/" - if mnt_point != "": - volumes = { - temporary_dir: { - "bind": mnt_point, - "mode": "rw", - }, - } - working_dir = mnt_point - redis_container = docker_client.containers.run( - image=run_image, - volumes=volumes, - auto_remove=True, - privileged=True, - working_dir=mnt_point, - command=command_str, - network_mode="host", - detach=True, - cpuset_cpus=db_cpuset_cpus, - pid_mode="host", - publish_all_ports=True, + redis_container = start_redis_container( + command_str, + db_cpuset_cpus, + docker_client, + mnt_point, + redis_containers, + run_image, + temporary_dir, ) - time.sleep(5) - - redis_containers.append(redis_container) - r = redis.StrictRedis(port=redis_proc_start_port) r.ping() redis_conns = [r] @@ -1251,9 +1228,10 @@ def process_self_contained_coordinator_stream( stdout=True, stderr=True ) ) + redis_container.remove() except docker.errors.NotFound: logging.info( - "When trying to stop DB container with id {} and image {} it was already stopped".format( + "When trying to fetch logs from DB container with id {} and image {} it was already stopped".format( redis_container.id, redis_container.image, ) @@ -1269,6 +1247,7 @@ def process_self_contained_coordinator_stream( for redis_container in redis_containers: try: redis_container.stop() + redis_container.remove() except docker.errors.NotFound: logging.info( "When trying to stop DB container with id {} and image {} it was already stopped".format( @@ -1282,6 +1261,7 @@ def process_self_contained_coordinator_stream( if type(redis_container) == Container: try: redis_container.stop() + redis_container.remove() except docker.errors.NotFound: logging.info( "When trying to stop Client container with id {} and image {} it was already stopped".format( @@ -1295,6 +1275,7 @@ def process_self_contained_coordinator_stream( temporary_dir, temporary_dir_client ) ) + shutil.rmtree(temporary_dir, ignore_errors=True) shutil.rmtree(temporary_dir_client, ignore_errors=True) @@ -1475,6 +1456,50 @@ def process_self_contained_coordinator_stream( return stream_id, overall_result, total_test_suite_runs +def start_redis_container( + command_str, + db_cpuset_cpus, + docker_client, + mnt_point, + redis_containers, + run_image, + temporary_dir, + auto_remove=False, +): + logging.info( + "Running redis-server on docker image {} (cpuset={}) with the following args: {}".format( + run_image, db_cpuset_cpus, command_str + ) + ) + volumes = {} + working_dir = "/" + if mnt_point != "": + volumes = { + temporary_dir: { + "bind": mnt_point, + "mode": "rw", + }, + } + logging.info(f"setting volume as follow: {volumes}. working_dir={mnt_point}") + working_dir = mnt_point + redis_container = docker_client.containers.run( + image=run_image, + volumes=volumes, + auto_remove=auto_remove, + privileged=True, + working_dir=mnt_point, + command=command_str, + network_mode="host", + detach=True, + cpuset_cpus=db_cpuset_cpus, + pid_mode="host", + publish_all_ports=True, + ) + time.sleep(5) + redis_containers.append(redis_container) + return redis_container + + def filter_test_files( defaults_filename, priority_lower_limit, diff --git a/tox.ini b/tox.ini index 1c973ba..cce3482 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,9 @@ docker = deps = -r{toxinidir}/dev_requirements.txt -# passenv = TST_BUILDER_X,TST_RUNNER_X,GH_TOKEN,TST_REDIS_DIR,DOCKER_HOST,DOCKER_TLS_VERIFY,DOCKER_CERT_PATH + + +passenv = TST_BUILDER_X,TST_RUNNER_X,GH_TOKEN,TST_REDIS_DIR,DOCKER_HOST,DOCKER_TLS_VERIFY,DOCKER_CERT_PATH,TST_BINARY_REDIS_DIR stoponfail = True diff --git a/utils/tests/test_self_contained_coordinator.py b/utils/tests/test_self_contained_coordinator.py index 8855de6..bbb91e5 100644 --- a/utils/tests/test_self_contained_coordinator.py +++ b/utils/tests/test_self_contained_coordinator.py @@ -7,6 +7,7 @@ from redisbench_admin.utils.remote import get_overall_dashboard_keynames from redisbench_admin.utils.utils import get_ts_metric_name +import logging from redis_benchmarks_specification.__common__.env import ( STREAM_KEYNAME_NEW_BUILD_EVENTS, @@ -18,6 +19,7 @@ ) from redis_benchmarks_specification.__self_contained_coordinator__.self_contained_coordinator import ( self_contained_coordinator_blocking_read, + start_redis_container, ) from redis_benchmarks_specification.__self_contained_coordinator__.runners import ( @@ -31,6 +33,11 @@ from utils.tests.test_data.api_builder_common import flow_1_and_2_api_builder_checks +from redis_benchmarks_specification.__self_contained_coordinator__.docker import ( + generate_standalone_redis_server_args, +) + + def test_extract_client_cpu_limit(): with open( "./utils/tests/test_data/test-suites/redis-benchmark-full-suite-1Mkeys-100B.yml", @@ -263,3 +270,51 @@ def test_self_contained_coordinator_blocking_read(): except redis.exceptions.ConnectionError: pass + + +def test_start_redis_container(): + temporary_dir = os.getenv("TST_BINARY_REDIS_DIR", "") + if temporary_dir == "": + return + + mnt_point = "/mnt/redis/" + executable = f"{mnt_point}redis-server" + redis_proc_start_port = 6379 + current_cpu_pos = 0 + ceil_db_cpu_limit = 1 + redis_configuration_parameters = None + redis_arguments = "" + docker_client = docker.from_env() + redis_containers = [] + + command = generate_standalone_redis_server_args( + executable, + redis_proc_start_port, + mnt_point, + redis_configuration_parameters, + redis_arguments, + ) + command_str = " ".join(command) + db_cpuset_cpus, current_cpu_pos = generate_cpuset_cpus( + ceil_db_cpu_limit, current_cpu_pos + ) + run_image = "gcc:8.5" + redis_container = start_redis_container( + command_str, + db_cpuset_cpus, + docker_client, + mnt_point, + redis_containers, + run_image, + temporary_dir, + ) + r = redis.StrictRedis(port=redis_proc_start_port) + try: + r.ping() + except redis.exceptions.ConnectionError: + # Access and print the logs + logs = redis_container.logs().decode("utf-8") + logging.error("Container failed. Here are the logs:") + logging.error(logs) + raise + redis_container.remove() diff --git a/utils/tests/test_self_contained_coordinator_memtier.py b/utils/tests/test_self_contained_coordinator_memtier.py index 3f5538c..ec4794b 100644 --- a/utils/tests/test_self_contained_coordinator_memtier.py +++ b/utils/tests/test_self_contained_coordinator_memtier.py @@ -204,7 +204,7 @@ def test_self_contained_coordinator_blocking_read(): assert len(datasink_conn.smembers(running_platforms_setname)) == 1 assert len(datasink_conn.smembers(testcases_setname)) == 1 assert len(datasink_conn.smembers(project_branches_setname)) == 1 - assert len(datasink_conn.smembers(project_versions_setname)) == 0 + assert len(datasink_conn.smembers(project_versions_setname)) == 1 except redis.exceptions.ConnectionError: pass