Skip to content

Commit e86f0c2

Browse files
Detect module plugins (#407)
1 parent 8d65eeb commit e86f0c2

File tree

3 files changed

+54
-28
lines changed

3 files changed

+54
-28
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.10.5"
3+
version = "0.10.6"
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 <filipecosta.90@gmail.com>","Redis Performance Group <performance@redis.com>"]
66
readme = "README.md"

redisbench_admin/run_remote/standalone.py

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,46 @@ def remote_module_files_cp(
7777
remote_module_files = []
7878
if local_module_files is not None:
7979
for local_module_file in local_module_files:
80-
remote_module_file = "{}/{}".format(
81-
remote_module_file_dir, os.path.basename(local_module_file)
82-
)
83-
# copy the module to the DB machine
84-
copy_file_to_remote_setup(
85-
server_public_ip,
86-
username,
87-
private_key,
88-
local_module_file,
89-
remote_module_file,
90-
None,
91-
port,
92-
)
93-
execute_remote_commands(
94-
server_public_ip,
95-
username,
96-
private_key,
97-
["chmod 755 {}".format(remote_module_file)],
98-
port,
99-
)
100-
remote_module_files.append(remote_module_file)
80+
81+
splitted_module_and_plugins = local_module_file.split(" ")
82+
if len(splitted_module_and_plugins) > 1:
83+
logging.info(
84+
"Detected a module and plugin(s) pairs {}".format(
85+
splitted_module_and_plugins
86+
)
87+
)
88+
abs_splitted_module_and_plugins = [
89+
os.path.abspath(x) for x in splitted_module_and_plugins
90+
]
91+
remote_module_files_in = ""
92+
for pos, local_module_file_and_plugin in enumerate(
93+
abs_splitted_module_and_plugins, start=1
94+
):
95+
remote_module_file = "{}/{}".format(
96+
remote_module_file_dir,
97+
os.path.basename(local_module_file_and_plugin),
98+
)
99+
# copy the module to the DB machine
100+
copy_file_to_remote_setup(
101+
server_public_ip,
102+
username,
103+
private_key,
104+
local_module_file_and_plugin,
105+
remote_module_file,
106+
None,
107+
port,
108+
)
109+
execute_remote_commands(
110+
server_public_ip,
111+
username,
112+
private_key,
113+
["chmod 755 {}".format(remote_module_file)],
114+
port,
115+
)
116+
if pos > 1:
117+
remote_module_files_in = remote_module_files_in + " "
118+
remote_module_files_in = remote_module_files_in + remote_module_file
119+
remote_module_files.append(remote_module_files_in)
101120
return remote_module_files
102121

103122

redisbench_admin/utils/utils.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,19 @@
2828
def redis_server_config_module_part(
2929
command, local_module_file, modules_configuration_parameters_map
3030
):
31-
command.extend(
32-
[
33-
"--loadmodule",
34-
os.path.abspath(local_module_file),
35-
]
36-
)
31+
# in the case of modules with plugins we split by space
32+
splitted_module_and_plugins = local_module_file.split(" ")
33+
if len(splitted_module_and_plugins) > 1:
34+
logging.info(
35+
"Detected a module and plugin(s) pairs {}".format(
36+
splitted_module_and_plugins
37+
)
38+
)
39+
abs_splitted_module_and_plugins = [
40+
os.path.abspath(x) for x in splitted_module_and_plugins
41+
]
42+
command.append("--loadmodule")
43+
command.extend(abs_splitted_module_and_plugins)
3744
for (
3845
module_config_modulename,
3946
module_config_dict,

0 commit comments

Comments
 (0)