Skip to content

Commit bd2a9cc

Browse files
In case of failure of DB sping, retrieve the log and push to S3 (#285)
1 parent 64ce4bc commit bd2a9cc

File tree

3 files changed

+61
-36
lines changed

3 files changed

+61
-36
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.6.18"
3+
version = "0.6.19"
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/remote_db.py

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -171,27 +171,48 @@ def remote_db_spin(
171171
)
172172

173173
if setup_type == "oss-standalone":
174-
full_logfile = spin_up_standalone_remote_redis(
175-
temporary_dir,
176-
server_public_ip,
177-
username,
178-
private_key,
179-
remote_module_files,
180-
logname,
181-
redis_configuration_parameters,
182-
db_ssh_port,
183-
modules_configuration_parameters_map,
184-
)
185-
full_logfiles.append(full_logfile)
186-
local_redis_conn, ssh_tunnel = ssh_tunnel_redisconn(
187-
server_plaintext_port,
188-
server_private_ip,
189-
server_public_ip,
190-
username,
191-
db_ssh_port,
192-
private_key,
193-
)
194-
redis_conns.append(local_redis_conn)
174+
175+
try:
176+
full_logfile = spin_up_standalone_remote_redis(
177+
temporary_dir,
178+
server_public_ip,
179+
username,
180+
private_key,
181+
remote_module_files,
182+
logname,
183+
redis_configuration_parameters,
184+
db_ssh_port,
185+
modules_configuration_parameters_map,
186+
)
187+
full_logfiles.append(full_logfile)
188+
local_redis_conn, ssh_tunnel = ssh_tunnel_redisconn(
189+
server_plaintext_port,
190+
server_private_ip,
191+
server_public_ip,
192+
username,
193+
db_ssh_port,
194+
private_key,
195+
)
196+
redis_conns.append(local_redis_conn)
197+
except redis.exceptions.ConnectionError as e:
198+
logging.error("A error occurred while spinning DB: {}".format(e.__str__()))
199+
remote_file = "{}/{}".format(temporary_dir, full_logfile)
200+
logging.error(
201+
"Trying to fetch DB remote log {} into {}".format(
202+
remote_file, full_logfile
203+
)
204+
)
205+
failed_remote_run_artifact_store(
206+
True,
207+
client_public_ip,
208+
dirname,
209+
remote_file,
210+
full_logfile,
211+
s3_bucket_name,
212+
s3_bucket_path,
213+
username,
214+
private_key,
215+
)
195216

196217
if cluster_enabled:
197218
setup_redis_cluster_from_conns(

redisbench_admin/run_remote/remote_failures.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,22 @@ def failed_remote_run_artifact_store(
2626
remote_file, local_file_fullpath
2727
)
2828
)
29-
fetch_file_from_remote_setup(
30-
client_public_ip,
31-
username,
32-
private_key,
33-
local_file_fullpath,
34-
remote_file,
35-
)
36-
if upload_results_s3:
37-
logging.info(
38-
"Uploading file {} to s3. s3 bucket name: {}. s3 bucket path: {}".format(
39-
local_file_fullpath, s3_bucket_name, s3_bucket_path
40-
)
29+
try:
30+
fetch_file_from_remote_setup(
31+
client_public_ip,
32+
username,
33+
private_key,
34+
local_file_fullpath,
35+
remote_file,
4136
)
42-
artifacts = [local_file_fullpath]
43-
upload_artifacts_to_s3(artifacts, s3_bucket_name, s3_bucket_path)
37+
except FileNotFoundError as f:
38+
logging.error("Unable to fetch remote file: {}".format(f.__str__()))
39+
finally:
40+
if upload_results_s3:
41+
logging.info(
42+
"Uploading file {} to s3. s3 bucket name: {}. s3 bucket path: {}".format(
43+
local_file_fullpath, s3_bucket_name, s3_bucket_path
44+
)
45+
)
46+
artifacts = [local_file_fullpath]
47+
upload_artifacts_to_s3(artifacts, s3_bucket_name, s3_bucket_path)

0 commit comments

Comments
 (0)