Skip to content

Commit 59eaf03

Browse files
Multi-Client Runner with pubsub-sub-bench Integration
1 parent 1c15717 commit 59eaf03

File tree

10 files changed

+1711
-114
lines changed

10 files changed

+1711
-114
lines changed

redis_benchmarks_specification/__cli__/stats.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,25 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
123123
)
124124
test_result = False
125125

126+
# Validate client configuration format
127+
has_clientconfig = "clientconfig" in benchmark_config
128+
has_clientconfigs = "clientconfigs" in benchmark_config
129+
130+
if has_clientconfig and has_clientconfigs:
131+
logging.error(
132+
"Test {} has both 'clientconfig' and 'clientconfigs'. Only one format is allowed.".format(
133+
test_name
134+
)
135+
)
136+
test_result = False
137+
elif not has_clientconfig and not has_clientconfigs:
138+
logging.error(
139+
"Test {} is missing client configuration. Must have either 'clientconfig' or 'clientconfigs'.".format(
140+
test_name
141+
)
142+
)
143+
test_result = False
144+
126145
test_names.append(test_name)
127146
group = ""
128147
is_memtier = False
@@ -150,12 +169,24 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
150169
for tested_command in origin_tested_commands:
151170
tested_commands.append(tested_command.lower())
152171
if is_memtier:
153-
arguments = benchmark_config["clientconfig"]["arguments"]
154-
arg_list = (
155-
benchmark_config["clientconfig"]["arguments"]
156-
.replace('"', "")
157-
.split()
158-
)
172+
# Handle both clientconfig and clientconfigs formats
173+
if "clientconfigs" in benchmark_config:
174+
# For multiple configs, use the first one for stats analysis
175+
# TODO: Consider aggregating stats from all configs
176+
arguments = benchmark_config["clientconfigs"][0]["arguments"]
177+
arg_list = (
178+
benchmark_config["clientconfigs"][0]["arguments"]
179+
.replace('"', "")
180+
.split()
181+
)
182+
else:
183+
# Legacy single clientconfig format
184+
arguments = benchmark_config["clientconfig"]["arguments"]
185+
arg_list = (
186+
benchmark_config["clientconfig"]["arguments"]
187+
.replace('"', "")
188+
.split()
189+
)
159190

160191
data_size = get_arg_value(arg_list, "--data-size", data_size)
161192
data_size = get_arg_value(arg_list, "-d", data_size)

redis_benchmarks_specification/__common__/spec.py

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,19 @@ def extract_redis_configuration_from_topology(topologies_map, topology_spec_name
5454

5555

5656
def extract_client_cpu_limit(benchmark_config):
57-
db_cpu_limit = benchmark_config["clientconfig"]["resources"]["requests"]["cpus"]
58-
ceil_db_cpu_limit = math.ceil(float(db_cpu_limit))
59-
return ceil_db_cpu_limit
57+
# Handle both clientconfig (single) and clientconfigs (multiple) formats
58+
if "clientconfigs" in benchmark_config:
59+
# For multiple configs, return the sum of all CPU limits
60+
total_cpu_limit = 0
61+
for client_config in benchmark_config["clientconfigs"]:
62+
cpu_limit = client_config["resources"]["requests"]["cpus"]
63+
total_cpu_limit += float(cpu_limit)
64+
return math.ceil(total_cpu_limit)
65+
else:
66+
# Legacy single clientconfig format
67+
db_cpu_limit = benchmark_config["clientconfig"]["resources"]["requests"]["cpus"]
68+
ceil_db_cpu_limit = math.ceil(float(db_cpu_limit))
69+
return ceil_db_cpu_limit
6070

6171

6272
def extract_build_variant_variations(benchmark_config, keyname="build-variants"):
@@ -74,9 +84,60 @@ def extract_client_container_image(benchmark_config, keyname="clientconfig"):
7484
return client_container_image
7585

7686

87+
def extract_client_container_images(benchmark_config):
88+
"""Extract container images for both single and multiple client configs"""
89+
if "clientconfigs" in benchmark_config:
90+
# Multiple client configs - return list of images
91+
images = []
92+
for client_config in benchmark_config["clientconfigs"]:
93+
if "run_image" in client_config:
94+
images.append(client_config["run_image"])
95+
else:
96+
images.append(None)
97+
return images
98+
elif "clientconfig" in benchmark_config:
99+
# Single client config - return list with one image for consistency
100+
if "run_image" in benchmark_config["clientconfig"]:
101+
return [benchmark_config["clientconfig"]["run_image"]]
102+
else:
103+
return [None]
104+
return []
105+
106+
77107
def extract_client_tool(benchmark_config, keyname="clientconfig"):
78108
client_tool = None
79109
if keyname in benchmark_config:
80110
if "tool" in benchmark_config[keyname]:
81111
client_tool = benchmark_config[keyname]["tool"]
82112
return client_tool
113+
114+
115+
def extract_client_tools(benchmark_config):
116+
"""Extract tools for both single and multiple client configs"""
117+
if "clientconfigs" in benchmark_config:
118+
# Multiple client configs - return list of tools
119+
tools = []
120+
for client_config in benchmark_config["clientconfigs"]:
121+
if "tool" in client_config:
122+
tools.append(client_config["tool"])
123+
else:
124+
tools.append(None)
125+
return tools
126+
elif "clientconfig" in benchmark_config:
127+
# Single client config - return list with one tool for consistency
128+
if "tool" in benchmark_config["clientconfig"]:
129+
return [benchmark_config["clientconfig"]["tool"]]
130+
else:
131+
return [None]
132+
return []
133+
134+
135+
def extract_client_configs(benchmark_config):
136+
"""Extract client configurations as a list for both single and multiple formats"""
137+
if "clientconfigs" in benchmark_config:
138+
# Multiple client configs
139+
return benchmark_config["clientconfigs"]
140+
elif "clientconfig" in benchmark_config:
141+
# Single client config - return as list for consistency
142+
return [benchmark_config["clientconfig"]]
143+
return []

redis_benchmarks_specification/__runner__/args.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ def create_client_runner_args(project_name):
208208
type=int,
209209
help="override memtier number of runs for each benchmark. By default will run once each test",
210210
)
211+
parser.add_argument(
212+
"--container-timeout-buffer",
213+
default=60,
214+
type=int,
215+
help="Buffer time in seconds to add to test-time for container timeout. Default is 60 seconds.",
216+
)
211217
parser.add_argument(
212218
"--cluster-mode",
213219
default=False,

0 commit comments

Comments
 (0)