From 496be7756f6eb89d5c48e69c30ec4f76810ed0f9 Mon Sep 17 00:00:00 2001 From: Russell Branca Date: Wed, 23 Mar 2016 19:42:27 +0000 Subject: [PATCH 1/2] Restructure export declaration --- src/basho_bench.erl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/basho_bench.erl b/src/basho_bench.erl index 50435b8ba..f9444ae03 100644 --- a/src/basho_bench.erl +++ b/src/basho_bench.erl @@ -23,7 +23,15 @@ -export([start/0]). --export([setup_benchmark/1, run_benchmark/1, await_completion/1, main/1, md5/1, get_test_dir/0]). +-export([ + setup_benchmark/1, + run_benchmark/1, + await_completion/1, + main/1, + md5/1, + get_test_dir/0 +]). + -include("basho_bench.hrl"). From 3a862bb46524e4d18410607d3a03020bf17a1911 Mon Sep 17 00:00:00 2001 From: Russell Branca Date: Wed, 23 Mar 2016 19:44:19 +0000 Subject: [PATCH 2/2] Load configs in setup process, not run process --- src/basho_bench.erl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/basho_bench.erl b/src/basho_bench.erl index f9444ae03..91d1cf557 100644 --- a/src/basho_bench.erl +++ b/src/basho_bench.erl @@ -24,7 +24,7 @@ -export([start/0]). -export([ - setup_benchmark/1, + setup_benchmark/2, run_benchmark/1, await_completion/1, main/1, @@ -42,7 +42,7 @@ start() -> %% API %% ==================================================================== -setup_benchmark(Opts) -> +setup_benchmark(Opts, Configs) -> BenchName = bench_name(Opts), TestDir = test_dir(Opts, BenchName), application:set_env(basho_bench, test_dir, TestDir), @@ -70,6 +70,11 @@ setup_benchmark(Opts) -> CustomLagerLevel = basho_bench_config:get(log_level, debug), lager:set_loglevel(lager_console_backend, CustomLagerLevel), lager:set_loglevel(lager_file_backend, ConsoleLog, CustomLagerLevel), + + %% Make sure this happens after starting lager or failures wont + %% show. + basho_bench_config:load(Configs), + case basho_bench_config:get(distribute_work, false) of true -> setup_distributed_work(); false -> ok @@ -91,10 +96,6 @@ run_benchmark(Configs) -> load_source_files(SourceDir) end, - %% Make sure this happens after starting lager or failures wont - %% show. - basho_bench_config:load(Configs), - %% Copy the config into the test dir for posterity [ begin {ok, _} = file:copy(Config, filename:join(TestDir, filename:basename(Config))) end || Config <- Configs ], @@ -125,7 +126,7 @@ main(Args) -> ok = maybe_net_node(Opts), ok = maybe_join(Opts), {ok, _} = start(), - setup_benchmark(Opts), + setup_benchmark(Opts, Configs), run_benchmark(Configs), await_completion(infinity).