Skip to content

Commit 77b5e10

Browse files
Added cluster mode support to teardown steps (#13)
* [add] Added cluster mode support to teardown steps * [add] Improved release draft
1 parent e2ff50f commit 77b5e10

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

.github/release-drafter-config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name-template: 'Version $NEXT_PATCH_VERSION - Summary Here🌈'
1+
name-template: 'Version $NEXT_PATCH_VERSION'
22
tag-template: 'v$NEXT_PATCH_VERSION'
33
categories:
4-
- title: '🚀Features'
4+
- title: 'Features'
55
labels:
66
- 'feature'
77
- 'enhancement'
@@ -10,7 +10,7 @@ categories:
1010
- 'fix'
1111
- 'bugfix'
1212
- 'bug'
13-
- title: '🧰Maintenance'
13+
- title: 'Maintenance'
1414
label: 'chore'
1515
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
1616
exclude-labels:

redisbench_admin/run/run.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def run_command_logic(args):
120120
progress = tqdm(unit="bench steps", total=total_steps)
121121
for repetition in range(1, args.repetitions + 1):
122122
if benchmark_repetitions_require_teardown is True or repetition == 1:
123-
aux_client = run_setup_commands(args, aux_client, benchmark_config, oss_cluster_mode)
123+
aux_client = run_setup_commands(args, "setup", benchmark_config["setup"]["commands"], oss_cluster_mode)
124124
if "setup" in run_stages_inputs:
125125
setup_run_key = "setup-run-{}.json".format(repetition)
126126
setup_run_json_output_fullpath = "{}/{}".format(local_path, setup_run_key)
@@ -145,15 +145,7 @@ def run_command_logic(args):
145145

146146
if benchmark_repetitions_require_teardown is True or repetition == args.repetitions:
147147
print("Running tear down steps...")
148-
for command in benchmark_config["teardown"]["commands"]:
149-
try:
150-
aux_client.execute_command(" ".join(command))
151-
except redis.connection.ConnectionError as e:
152-
print(
153-
'Error while issuing teardown command to Redis.Command {}! Error message: {} Exiting..'.format(
154-
command,
155-
e.__str__()))
156-
sys.exit(1)
148+
run_setup_commands(args, "tear down", benchmark_config["teardown"]["commands"], oss_cluster_mode)
157149

158150
progress.update()
159151
end_time = dt.datetime.now()
@@ -197,9 +189,8 @@ def run_command_logic(args):
197189
artifacts = [benchmark_output_filename]
198190
upload_artifacts_to_s3(artifacts, s3_bucket_name, s3_bucket_path)
199191

200-
201-
def run_setup_commands(args, aux_client, benchmark_config, cluster_enabled):
202-
print("Running setup steps...")
192+
def run_setup_commands(args, step_string_description, commands, cluster_enabled):
193+
print("Running {} steps...".format(step_string_description))
203194
try:
204195
if cluster_enabled:
205196
host_port_arr = args.redis_url.split(":")
@@ -208,15 +199,15 @@ def run_setup_commands(args, aux_client, benchmark_config, cluster_enabled):
208199
startup_nodes = [{"host": host, "port": port}]
209200
aux_client = RedisCluster(startup_nodes=startup_nodes, decode_responses=True)
210201
cluster_nodes = aux_client.cluster_nodes()
211-
for command in benchmark_config["setup"]["commands"]:
202+
for command in commands:
212203
for master_node in aux_client.connection_pool.nodes.all_masters():
213204
redis.from_url("redis://"+master_node["name"]).execute_command(" ".join(command))
214205
else:
215206
aux_client = redis.from_url(args.redis_url)
216-
for command in benchmark_config["setup"]["commands"]:
207+
for command in commands:
217208
aux_client.execute_command(" ".join(command))
218209
except redis.connection.ConnectionError as e:
219-
print('Error while issuing setup command to Redis.Command {}! Error message: {} Exiting..'.format(command,
210+
print('Error while issuing {} steps command to Redis.Command {}! Error message: {} Exiting..'.format(step_string_description, command,
220211
e.__str__()))
221212
sys.exit(1)
222213
return aux_client

0 commit comments

Comments
 (0)