Skip to content

Commit db11b9c

Browse files
Added run-remote runner (#44)
* [add] Added run-remote runner
1 parent 55da57c commit db11b9c

File tree

12 files changed

+473
-37
lines changed

12 files changed

+473
-37
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redisbench-admin"
3-
version = "0.1.43"
3+
version = "0.1.44"
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]>"]
66
readme = "README.md"

redisbench_admin/cli.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
from redisbench_admin.run.run import run_command_logic
1717
from redisbench_admin.run_local.args import create_run_local_arguments
1818
from redisbench_admin.run_local.run_local import run_local_command_logic
19+
from redisbench_admin.run_remote.args import create_run_remote_arguments
20+
from redisbench_admin.run_remote.run_remote import run_remote_command_logic
1921

2022

2123
def populate_with_poetry_data():
@@ -60,8 +62,8 @@ def main():
6062
"--local-dir", type=str, default="./", help="local dir to use as storage"
6163
)
6264

63-
if requested_tool == "run":
64-
parser = create_run_arguments(parser)
65+
if requested_tool == "run-remote":
66+
parser = create_run_remote_arguments(parser)
6567
elif requested_tool == "run-local":
6668
parser = create_run_local_arguments(parser)
6769
elif requested_tool == "extract":
@@ -77,17 +79,16 @@ def main():
7779
print_help(project_name, project_version)
7880
sys.exit(0)
7981
else:
80-
valid_tool_options = ["run", "run-local", "export", "compare", "retrieve"]
82+
valid_tool_options = ["run-local", "run-remote", "export", "compare", "retrieve"]
8183
print_invalid_tool_option(requested_tool, valid_tool_options)
8284
sys.exit(1)
8385

8486
argv = sys.argv[2:]
8587
args = parser.parse_args(args=argv)
86-
87-
if requested_tool == "run":
88-
run_command_logic(args)
8988
if requested_tool == "run-local":
9089
run_local_command_logic(args)
90+
if requested_tool == "run-remote":
91+
run_remote_command_logic(args)
9192
if requested_tool == "compare":
9293
compare_command_logic(args)
9394
if requested_tool == "export":
@@ -120,7 +121,7 @@ def print_help(project_name, project_version):
120121
)
121122
print("usage: {project_name} <tool> <args>...".format(project_name=project_name))
122123
print(
123-
"\t-) To know more on how to run benchmarks: {project_name} run --help".format(
124+
"\t-) To know more on how to run benchmarks: {project_name} run-remote/run-local --help".format(
124125
project_name=project_name
125126
)
126127
)

redisbench_admin/run/ftsb_redisearch/ftsb_redisearch.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ def get_run_options():
3333

3434

3535
def run_ftsb_redisearch(
36-
redis_url,
37-
ftsb_redisearch_path,
38-
setup_run_json_output_fullpath,
39-
options,
40-
input_file,
41-
workers=1,
42-
pipeline=1,
43-
oss_cluster_mode=False,
44-
max_rps=0,
45-
requests=0,
46-
continue_on_error=False,
47-
args=[],
36+
redis_url,
37+
ftsb_redisearch_path,
38+
setup_run_json_output_fullpath,
39+
options,
40+
input_file,
41+
workers=1,
42+
pipeline=1,
43+
oss_cluster_mode=False,
44+
max_rps=0,
45+
requests=0,
46+
continue_on_error=False,
47+
args=[],
4848
):
4949
##################
5050
# Setup commands #

redisbench_admin/run/redis_benchmark/redis_benchmark.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ def prepareRedisBenchmarkCommand(
5555
" ".join(queries_str)
5656
)
5757
)
58-
return queries_str
58+
return queries_str

redisbench_admin/run/run.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import logging
2-
import os
3-
import os.path
42
import re
53
import subprocess
64

75
from cpuinfo import cpuinfo
86

7+
98
def run_command_logic(args):
109
use_case_specific_arguments = dict(args.__dict__)
1110
# local_path = os.path.abspath(args.local_dir)
@@ -47,4 +46,4 @@ def redis_benchmark_ensure_min_version(benchmark_tool, benchmark_min_tool_versio
4746
major == benchmark_min_tool_version_major and minor == benchmark_min_tool_version_minor and patch < benchmark_min_tool_version_patch):
4847
raise Exception(
4948
"Detected benchmark version that is inferior than the minimum required. {} < {}".format(
50-
version_output, benchmark_min_tool_version))
49+
version_output, benchmark_min_tool_version))

redisbench_admin/run_local/run_local.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,21 @@ def run_local_command_logic(args):
131131
entry
132132
)
133133
if benchmark_tool == 'redisgraph-benchmark-go':
134+
print(entry)
134135
command = prepareRedisGraphBenchmarkGoCommand(
135136
"redisgraph-benchmark-go",
136137
"localhost",
137-
args.redisgraph_port,
138-
benchmark_config,
138+
args.port,
139+
entry,
139140
local_benchmark_output_filename,
140141
)
141142

142143
# run the benchmark
143-
benchmark_client_process = subprocess.Popen(args=command, stdout=subprocess.PIPE,
144-
stderr=subprocess.STDOUT)
144+
if benchmark_tool == 'redis-benchmark':
145+
benchmark_client_process = subprocess.Popen(args=command, stdout=subprocess.PIPE,
146+
stderr=subprocess.STDOUT)
147+
else:
148+
benchmark_client_process = subprocess.Popen(args=command)
145149
(stdout, sterr) = benchmark_client_process.communicate()
146150
logging.info("Extracting the benchmark results")
147151

redisbench_admin/run_remote/__init__.py

Whitespace-only changes.

redisbench_admin/run_remote/args.py

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import os
2+
import socket
3+
4+
# environment variables
5+
PERFORMANCE_RTS_AUTH = os.getenv("PERFORMANCE_RTS_AUTH", None)
6+
PERFORMANCE_RTS_HOST = os.getenv("PERFORMANCE_RTS_HOST", 6379)
7+
PERFORMANCE_RTS_PORT = os.getenv("PERFORMANCE_RTS_PORT", None)
8+
TERRAFORM_BIN_PATH = os.getenv("TERRAFORM_BIN_PATH", "terraform")
9+
10+
11+
def create_run_remote_arguments(parser):
12+
parser.add_argument("--module_path", type=str, required=True)
13+
parser.add_argument("--allowed-tools", type=str, default="redis-benchmark,redisgraph-benchmark-go",
14+
help="comma separated list of allowed tools for this module. By default all the supported are allowed.")
15+
parser.add_argument(
16+
"--test",
17+
type=str,
18+
default="",
19+
help="specify a test to run. By default will run all of them.",
20+
)
21+
parser.add_argument("--github_actor", type=str, default=None)
22+
parser.add_argument("--github_repo", type=str, default=None)
23+
parser.add_argument("--github_org", type=str, default=None)
24+
parser.add_argument("--github_sha", type=str, default=None)
25+
parser.add_argument("--github_branch", type=str, default=None)
26+
parser.add_argument("--triggering_env", type=str, default=socket.gethostname())
27+
parser.add_argument("--terraform_bin_path", type=str, default=TERRAFORM_BIN_PATH)
28+
parser.add_argument("--setup_name_sufix", type=str, default="")
29+
parser.add_argument(
30+
"--s3_bucket_name",
31+
type=str,
32+
default="ci.benchmarks.redislabs",
33+
help="S3 bucket name.",
34+
)
35+
parser.add_argument(
36+
"--upload_results_s3",
37+
default=False,
38+
action="store_true",
39+
help="uploads the result files and configuration file to public ci.benchmarks.redislabs bucket. Proper credentials are required",
40+
)
41+
parser.add_argument("--redistimesies_host", type=str, default=PERFORMANCE_RTS_HOST)
42+
parser.add_argument("--redistimesies_port", type=int, default=PERFORMANCE_RTS_PORT)
43+
parser.add_argument("--redistimesies_pass", type=str, default=PERFORMANCE_RTS_AUTH)
44+
parser.add_argument(
45+
"--push_results_redistimeseries",
46+
default=False,
47+
action="store_true",
48+
help="uploads the results to RedisTimeSeries. Proper credentials are required",
49+
)
50+
parser.add_argument(
51+
"--skip-env-vars-verify",
52+
default=False,
53+
action="store_true",
54+
help="skip environment variables check",
55+
)
56+
return parser

0 commit comments

Comments
 (0)