Skip to content

Commit 98505ca

Browse files
Enabled TF_OVERRIDE_NAME. Updated ann-benchmark to the latest (#329)
* Added deployment_name zsets * Enabled TF_OVERRIDE_NAME. Updated ann-benchmark to the latest * Fixes per flake check
1 parent 61f15a0 commit 98505ca

File tree

10 files changed

+71
-40
lines changed

10 files changed

+71
-40
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.7.23"
3+
version = "0.7.24"
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/compare/args.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ def create_compare_arguments(parser):
3333
"--test",
3434
type=str,
3535
default="",
36-
help="specify a test to use for comparison. If none is specified by default will use all of them.",
36+
help="specify a test (or a comma separated list of tests) to use for comparison. If none is specified by default will use all of them.",
3737
)
3838
parser.add_argument("--github_repo", type=str, default=GITHUB_REPO)
3939
parser.add_argument("--github_org", type=str, default=GITHUB_ORG)
4040
parser.add_argument("--triggering_env", type=str, default=TRIGGERING_ENV)
41-
parser.add_argument("--deployment_type", type=str, default="oss-standalone")
4241
parser.add_argument("--deployment_name", type=str, default="oss-standalone")
42+
parser.add_argument("--deployment_type", type=str, default="oss-standalone")
43+
parser.add_argument("--baseline_deployment_name", type=str, default="")
44+
parser.add_argument("--comparison_deployment_name", type=str, default="")
4345
parser.add_argument("--metric_name", type=str, default="Tests.Overall.rps")
4446
parser.add_argument(
4547
"--metric_mode",

redisbench_admin/compare/compare.py

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,19 @@ def compare_command_logic(args, project_name, project_version):
3939
tf_github_org = args.github_org
4040
tf_github_repo = args.github_repo
4141
tf_triggering_env = args.triggering_env
42-
deployment_type = args.deployment_type
43-
deployment_name = args.deployment_name
42+
if args.baseline_deployment_name != "":
43+
baseline_deployment_name = args.baseline_deployment_name
44+
else:
45+
baseline_deployment_name = args.deployment_name
46+
if args.comparison_deployment_name != "":
47+
comparison_deployment_name = args.comparison_deployment_name
48+
else:
49+
comparison_deployment_name = args.deployment_name
50+
4451
logging.info(
45-
"Using deployment_type={} and deployment_name={} for the analysis".format(
46-
deployment_type,
47-
deployment_name,
52+
"Using baseline deployment_name={} and comparison deployment_name={} for the analysis".format(
53+
baseline_deployment_name,
54+
comparison_deployment_name,
4855
)
4956
)
5057
from_ts_ms = args.from_timestamp
@@ -115,32 +122,35 @@ def compare_command_logic(args, project_name, project_version):
115122
used_key = testcases_metric_context_path_setname
116123

117124
tags_regex_string = re.compile(args.testname_regex)
125+
if args.test != "":
126+
test_names = args.test.split(",")
127+
logging.info("Using test name {}".format(test_names))
128+
else:
129+
try:
130+
test_names = rts.smembers(used_key)
131+
test_names = list(test_names)
132+
test_names.sort()
133+
final_test_names = []
134+
for test_name in test_names:
135+
test_name = test_name.decode()
136+
match_obj = re.search(tags_regex_string, test_name)
137+
if match_obj is not None:
138+
final_test_names.append(test_name)
139+
test_names = final_test_names
118140

119-
try:
120-
test_names = rts.smembers(used_key)
121-
test_names = list(test_names)
122-
test_names.sort()
123-
final_test_names = []
124-
for test_name in test_names:
125-
test_name = test_name.decode()
126-
match_obj = re.search(tags_regex_string, test_name)
127-
if match_obj is not None:
128-
final_test_names.append(test_name)
129-
test_names = final_test_names
141+
except redis.exceptions.ResponseError as e:
142+
logging.warning(
143+
"Error while trying to fetch test cases set (key={}) {}. ".format(
144+
used_key, e.__str__()
145+
)
146+
)
147+
pass
130148

131-
except redis.exceptions.ResponseError as e:
132149
logging.warning(
133-
"Error while trying to fetch test cases set (key={}) {}. ".format(
134-
used_key, e.__str__()
150+
"Based on test-cases set (key={}) we have {} comparison points. ".format(
151+
used_key, len(test_names)
135152
)
136153
)
137-
pass
138-
139-
logging.warning(
140-
"Based on test-cases set (key={}) we have {} comparison points. ".format(
141-
used_key, len(test_names)
142-
)
143-
)
144154
profilers_artifacts_matrix = []
145155
detected_regressions = []
146156
total_improvements = 0
@@ -154,23 +164,32 @@ def compare_command_logic(args, project_name, project_version):
154164
"{}={}".format(by_str, baseline_str),
155165
"metric={}".format(metric_name),
156166
"{}={}".format(test_filter, test_name),
157-
"deployment_type={}".format(deployment_type),
158-
"deployment_name={}".format(deployment_name),
167+
"deployment_name={}".format(baseline_deployment_name),
168+
"triggering_env={}".format(tf_triggering_env),
159169
]
160170
filters_comparison = [
161171
"{}={}".format(by_str, comparison_str),
162172
"metric={}".format(metric_name),
163173
"{}={}".format(test_filter, test_name),
164-
"deployment_type={}".format(deployment_type),
165-
"deployment_name={}".format(deployment_name),
174+
"deployment_name={}".format(comparison_deployment_name),
175+
"triggering_env={}".format(tf_triggering_env),
166176
]
167177
baseline_timeseries = rts.ts().queryindex(filters_baseline)
168178
comparison_timeseries = rts.ts().queryindex(filters_comparison)
179+
180+
# avoiding target time-series
181+
comparison_timeseries = [x for x in comparison_timeseries if "target" not in x]
182+
baseline_timeseries = [x for x in baseline_timeseries if "target" not in x]
169183
progress.update()
184+
if args.verbose:
185+
logging.info("Baseline timeseries {}".format(len(baseline_timeseries)))
186+
logging.info("Comparison timeseries {}".format(len(comparison_timeseries)))
170187
if len(baseline_timeseries) != 1:
171188
if args.verbose:
172189
logging.warning(
173-
"Baseline timeseries {}".format(len(baseline_timeseries))
190+
"Skipping this test given the value of timeseries !=1. Baseline timeseries {}".format(
191+
len(baseline_timeseries)
192+
)
174193
)
175194
continue
176195
else:
@@ -326,8 +345,8 @@ def compare_command_logic(args, project_name, project_version):
326345
),
327346
headers=[
328347
"Test Case",
329-
"Baseline (median obs. +- std.dev)",
330-
"Comparison (median obs. +- std.dev)",
348+
"Baseline {} (median obs. +- std.dev)".format(baseline_branch),
349+
"Comparison {} (median obs. +- std.dev)".format(comparison_branch),
331350
"% change ({})".format(metric_mode),
332351
"Note",
333352
],

redisbench_admin/run_remote/args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818

1919
REMOTE_INVENTORY = os.getenv("INVENTORY", None)
20+
TF_OVERRIDE_NAME = os.getenv("TF_OVERRIDE_NAME", None)
2021
REMOTE_USER = os.getenv("REMOTE_USER", "ubuntu")
2122

2223

redisbench_admin/run_remote/remote_env.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def remote_env_setup(
2525
tf_setup_name_sufix,
2626
tf_triggering_env,
2727
tf_timeout_secs=7200,
28+
tf_override_name=None,
2829
):
2930
server_plaintext_port = 6379
3031
db_ssh_port = args.db_ssh_port
@@ -67,6 +68,7 @@ def remote_env_setup(
6768
tf_setup_name_sufix,
6869
tf_triggering_env,
6970
tf_timeout_secs,
71+
tf_override_name,
7072
)
7173
return (
7274
client_public_ip,

redisbench_admin/run_remote/run_remote.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from redisbench_admin.run.run import define_benchmark_plan
4040
from redisbench_admin.run.s3 import get_test_s3_bucket_path
4141
from redisbench_admin.run.ssh import ssh_pem_check
42+
from redisbench_admin.run_remote.args import TF_OVERRIDE_NAME
4243
from redisbench_admin.run_remote.consts import min_recommended_benchmark_duration
4344
from redisbench_admin.run_remote.remote_client import run_remote_client_tool
4445
from redisbench_admin.run_remote.remote_db import (
@@ -331,6 +332,7 @@ def run_remote_command_logic(args, project_name, project_version):
331332
tf_setup_name_sufix,
332333
tf_triggering_env,
333334
tf_timeout_secs,
335+
TF_OVERRIDE_NAME,
334336
)
335337

336338
# after we've created the env, even on error we should always teardown

redisbench_admin/run_remote/terraform.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def terraform_spin_or_reuse_env(
2828
tf_setup_name_sufix,
2929
tf_triggering_env,
3030
tf_timeout_secs=7200,
31+
tf_override_name=None,
3132
):
3233
(
3334
remote_setup,
@@ -39,7 +40,10 @@ def terraform_spin_or_reuse_env(
3940
repetition, BENCHMARK_REPETITIONS, test_name, remote_setup
4041
)
4142
)
42-
tf_setup_name = "{}{}".format(remote_setup, tf_setup_name_sufix)
43+
if tf_override_name is None:
44+
tf_setup_name = "{}{}".format(remote_setup, tf_setup_name_sufix)
45+
else:
46+
tf_setup_name = tf_override_name
4347
logging.info("Using full setup name: {}".format(tf_setup_name))
4448
if remote_id not in remote_envs:
4549
# check if terraform is present

redisbench_admin/utils/remote.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ def setup_remote_environment(
256256
tf_triggering_env,
257257
tf_timeout_secs=7200,
258258
):
259-
# key = "benchmarks/infrastructure/tf-oss-redisgraph-standalone-r5.tfstate"
260259
_, _, _ = tf.init(
261260
capture_output=True,
262261
backend_config={

tests/test_redistimeseries.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ def test_timeseries_test_sucess_flow():
111111
assert rts.zcard(testcases_zsetname)
112112
assert rts.zcard(testcases_zsetname_component_search)
113113
assert test_name.encode() in rts.zpopmin(testcases_zsetname)[0][0]
114-
assert deployment_name.encode() in rts.zpopmin(deployment_name_setname)[0][0]
114+
assert (
115+
deployment_name.encode() in rts.zpopmin(deployment_name_setname)[0][0]
116+
)
115117
assert rts.exists(testcases_zsetname_component_search)
116118
assert (
117119
test_name.encode()

0 commit comments

Comments
 (0)