Skip to content

Commit d809c27

Browse files
Added --spin-test, --redis-server-binary, and --redis-config options to run-remote (#453)
1 parent 05ed56e commit d809c27

File tree

4 files changed

+496
-9
lines changed

4 files changed

+496
-9
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redisbench-admin"
3-
version = "0.11.40"
3+
version = "0.11.41"
44
description = "Redis benchmark run helper. A wrapper around Redis and Redis Modules benchmark tools ( ftsb_redisearch, memtier_benchmark, redis-benchmark, aibench, etc... )."
55
authors = ["filipecosta90 <[email protected]>","Redis Performance Group <[email protected]>"]
66
readme = "README.md"

redisbench_admin/run_remote/args.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,25 @@ def create_run_remote_arguments(parser):
130130
action="store_true",
131131
help="Continue running benchmarks even if module check failed",
132132
)
133+
parser.add_argument(
134+
"--redis-conf",
135+
required=False,
136+
default=None,
137+
type=str,
138+
help="Path to custom redis.conf file to copy to remote host",
139+
)
140+
parser.add_argument(
141+
"--redis-server-binary",
142+
required=False,
143+
default=None,
144+
type=str,
145+
help="Path to custom redis-server binary to copy to remote host",
146+
)
147+
parser.add_argument(
148+
"--spin-test",
149+
default=False,
150+
action="store_true",
151+
help="Setup standalone Redis server, run INFO SERVER, print output as markdown and exit",
152+
)
133153

134154
return parser

redisbench_admin/run_remote/run_remote.py

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
remote_db_spin,
5252
db_error_artifacts,
5353
)
54+
from redisbench_admin.run_remote.standalone import spin_test_standalone_redis
5455
from redisbench_admin.run_remote.remote_env import remote_env_setup
5556
from redisbench_admin.run_remote.remote_failures import failed_remote_run_artifact_store
5657
from redisbench_admin.run_remote.terraform import (
@@ -122,12 +123,15 @@ def run_remote_command_logic(args, project_name, project_version):
122123
tf_setup_name_sufix = "{}-{}".format(args.setup_name_sufix, tf_github_sha)
123124
s3_bucket_name = args.s3_bucket_name
124125
local_module_files = args.module_path
125-
for pos, module_file in enumerate(local_module_files):
126-
if " " in module_file:
127-
logging.info(
128-
"Detected multiple files in single module path {}".format(module_file)
129-
)
130-
local_module_files[pos] = module_file.split(" ")
126+
if local_module_files is not None:
127+
for pos, module_file in enumerate(local_module_files):
128+
if " " in module_file:
129+
logging.info(
130+
"Detected multiple files in single module path {}".format(
131+
module_file
132+
)
133+
)
134+
local_module_files[pos] = module_file.split(" ")
131135
dbdir_folder = args.dbdir_folder
132136
private_key = args.private_key
133137
grafana_profile_dashboard = args.grafana_profile_dashboard
@@ -238,6 +242,50 @@ def run_remote_command_logic(args, project_name, project_version):
238242

239243
ssh_pem_check(EC2_PRIVATE_PEM, private_key)
240244

245+
# Handle spin-test mode
246+
if args.spin_test:
247+
logging.info(
248+
"🚀 Spin-test mode detected - setting up standalone Redis and running INFO SERVER"
249+
)
250+
251+
# Parse inventory to get server details
252+
if args.inventory is None:
253+
logging.error(
254+
"❌ --spin-test requires --inventory to specify the remote server"
255+
)
256+
exit(1)
257+
258+
# Parse inventory string
259+
inventory_parts = args.inventory.split(",")
260+
server_public_ip = None
261+
262+
for part in inventory_parts:
263+
if "=" in part:
264+
key, value = part.split("=", 1)
265+
if key.strip() == "server_public_ip":
266+
server_public_ip = value.strip()
267+
break
268+
269+
if server_public_ip is None:
270+
logging.error("❌ --spin-test requires server_public_ip in --inventory")
271+
exit(1)
272+
273+
# Run spin test
274+
success = spin_test_standalone_redis(
275+
server_public_ip=server_public_ip,
276+
username=args.user,
277+
private_key=private_key,
278+
db_ssh_port=args.db_ssh_port,
279+
redis_port=args.db_port,
280+
local_module_files=local_module_files,
281+
redis_configuration_parameters=None,
282+
modules_configuration_parameters_map=None,
283+
custom_redis_conf_path=args.redis_conf,
284+
custom_redis_server_path=args.redis_server_binary,
285+
)
286+
287+
exit(0 if success else 1)
288+
241289
(
242290
benchmark_defs_result,
243291
benchmark_definitions,

0 commit comments

Comments
 (0)