Skip to content

Commit 9783489

Browse files
[add] Enabled logfile on remote setups. Fetching remote logfile in case of errors (#149)
1 parent f36f11a commit 9783489

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
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.2.12"
3+
version = "0.2.13"
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/run_remote/run_remote.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
get_project_ts_tags,
5454
get_overall_dashboard_keynames,
5555
check_ec2_env,
56+
fetch_file_from_remote_setup,
5657
)
5758
from sshtunnel import SSHTunnelForwarder
5859

@@ -362,20 +363,22 @@ def run_remote_command_logic(args):
362363
# after we've created the env, even on error we should always teardown
363364
# in case of some unexpected error we fail the test
364365
try:
365-
366+
_, _, testcase_start_time_str = get_start_time_vars()
367+
logname = "{}_{}.log".format(test_name, testcase_start_time_str)
366368
(
367369
redis_configuration_parameters,
368370
dataset_load_timeout_secs,
369371
) = extract_redis_dbconfig_parameters(benchmark_config, "dbconfig")
370372
# setup Redis
371-
spin_up_standalone_remote_redis(
373+
full_logfile = spin_up_standalone_remote_redis(
372374
benchmark_config,
373375
server_public_ip,
374376
username,
375377
private_key,
376378
local_module_file,
377379
remote_module_file,
378380
remote_dataset_file,
381+
logname,
379382
dirname,
380383
redis_configuration_parameters,
381384
dbdir_folder,
@@ -533,7 +536,7 @@ def run_remote_command_logic(args):
533536

534537
benchmark_start_time = datetime.datetime.now()
535538
# run the benchmark
536-
_, stdout, _ = run_remote_benchmark(
539+
remote_run_result, stdout, _ = run_remote_benchmark(
537540
client_public_ip,
538541
username,
539542
private_key,
@@ -542,6 +545,30 @@ def run_remote_command_logic(args):
542545
command_str,
543546
)
544547
benchmark_end_time = datetime.datetime.now()
548+
if remote_run_result is False:
549+
local_logfile = "{}/{}".format(dirname, logname)
550+
logging.error(
551+
"The benchmark returned an error exit status. Fetching remote logfile {} into {}".format(
552+
full_logfile, local_logfile
553+
)
554+
)
555+
fetch_file_from_remote_setup(
556+
client_public_ip,
557+
username,
558+
private_key,
559+
local_logfile,
560+
full_logfile,
561+
)
562+
if args.upload_results_s3:
563+
logging.info(
564+
"Uploading logfile {} to s3. s3 bucket name: {}. s3 bucket path: {}".format(
565+
local_logfile, s3_bucket_name, s3_bucket_path
566+
)
567+
)
568+
artifacts = [local_logfile]
569+
upload_artifacts_to_s3(
570+
artifacts, s3_bucket_name, s3_bucket_path
571+
)
545572
benchmark_duration_seconds = (
546573
benchmark_end_time - benchmark_start_time
547574
).seconds

redisbench_admin/utils/redisgraph_benchmark_go.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def spin_up_standalone_remote_redis(
2121
local_module_file,
2222
remote_module_file,
2323
remote_dataset_file,
24+
logfile,
2425
dirname=".",
2526
redis_configuration_parameters=None,
2627
dbdir_folder=None,
@@ -35,11 +36,10 @@ def spin_up_standalone_remote_redis(
3536
dirname,
3637
)
3738
temporary_dir = "/tmp"
38-
initial_redis_cmd = (
39-
'redis-server --save "" --dir {} --daemonize yes --protected-mode no'.format(
40-
temporary_dir
41-
)
39+
initial_redis_cmd = 'redis-server --save "" --logfile {} --dir {} --daemonize yes --protected-mode no'.format(
40+
logfile, temporary_dir
4241
)
42+
full_logfile = "{}/{}".format(temporary_dir, logfile)
4343
if dbdir_folder is not None:
4444
logging.info(
4545
"Copying entire content of {} into temporary path: {}".format(
@@ -77,6 +77,7 @@ def spin_up_standalone_remote_redis(
7777
# start redis-server
7878
commands = [initial_redis_cmd]
7979
execute_remote_commands(server_public_ip, username, private_key, commands)
80+
return full_logfile
8081

8182

8283
def setup_remote_benchmark_tool_redisgraph_benchmark_go(

0 commit comments

Comments
 (0)