Skip to content

Commit 1ef3e5d

Browse files
committed
Fixed a bug, were k8s workers not installed.
Added `provision_workers` option to install workers separately from `provision_nodes` option.
1 parent 34db7f3 commit 1ef3e5d

File tree

9 files changed

+42
-6
lines changed

9 files changed

+42
-6
lines changed

bin/mzbench

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Usage:
3434
[--node_commit=<commit>]
3535
[--deallocate_after_bench=<deallocate_after_bench>]
3636
[--provision_nodes=<provision_nodes>]
37+
[--provision_workers=<provision_workers>]
3738
[--name=<benchmark_name>]
3839
[--cloud=<cloud_provider_name>]
3940
[--tags=<tags>]
@@ -109,6 +110,11 @@ Options:
109110
to "true" indicates to perform nodes provision. Disabling
110111
it is useful when reusing already preallocated and
111112
provisioned nodes.
113+
--provision_workers <provision_workers>
114+
Either "true" or "false". Default is "true". Setting this
115+
to "true" indicates to perform workers provision. Disabling
116+
it is useful when reusing already preallocated and
117+
provisioned workers.
112118
--name <benchmark_name>
113119
Set benchmark name.
114120
--cloud <cloud_provider_name>
@@ -317,18 +323,18 @@ def pretty_print(data):
317323
print()
318324

319325
def run(host, script_file, script_content, email, nodes, workers_per_node,
320-
node_commit, deallocate_after_bench, provision_nodes,
326+
node_commit, deallocate_after_bench, provision_nodes, provision_workers,
321327
name, cloud, tags, env, no_cert_check = False, exclusive = None):
322328
bench_id = start(host, script_file, script_content, email, node_commit,
323329
nodes, workers_per_node, deallocate_after_bench, provision_nodes,
324-
name, cloud, tags, env, no_cert_check, exclusive)
330+
provision_workers, name, cloud, tags, env, no_cert_check, exclusive)
325331
response = status(host, bench_id, wait=True, no_cert_check = no_cert_check)
326332
if response[u'status'] == u'failed':
327333
print('Bench failed')
328334
sys.exit(3)
329335

330336
def start(host, script_file, script_content, email, node_commit, nodes,
331-
workers_per_node, deallocate_after_bench, provision_nodes,
337+
workers_per_node, deallocate_after_bench, provision_nodes, provision_workers,
332338
name, cloud, tags, env, no_cert_check = False, exclusive = None):
333339
try:
334340
response = api.start(host,
@@ -338,6 +344,7 @@ def start(host, script_file, script_content, email, node_commit, nodes,
338344
node_commit=node_commit,
339345
deallocate_after_bench=deallocate_after_bench,
340346
provision_nodes=provision_nodes,
347+
provision_workers=provision_workers,
341348
benchmark_name=name,
342349
cloud=cloud,
343350
tags=tags,
@@ -684,6 +691,11 @@ def augment_args(args):
684691
args['--provision_nodes']))
685692
sys.exit(4)
686693

694+
if args['--provision_workers'] not in [None, 'true', 'false']:
695+
print("invalid value for --provision_workers: {0}".format(
696+
args['--provision_workers']))
697+
sys.exit(4)
698+
687699
script_file = args['<script_file>']
688700
if script_file:
689701
if not os.path.exists(script_file):

doc/api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ deallocate_after_bench=false
5252
provision_nodes=false
5353
: Pass to skip MZBench installation on the nodes.
5454

55+
provision_workers=false
56+
: Pass to skip Workers installation on the nodes.
57+
5558
node_commit
5659
: Commit hash or branch name in the [MZBench repository](https://github.com/satori-com/mzbench/) that should be installed on the nodes.
5760

doc/cli.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ Optional params:
102102
`--provision_nodes false`
103103
: Skip MZBench installation on the nodes.
104104

105+
`--provision_workers false`
106+
: Skip Workers installation on the nodes.
107+
105108
`--node_commit=<commit>`
106109
: Commit hash or branch name in the MZBench repository pointing to the MZBench version to install on the nodes.
107110

doc_old/api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ deallocate_after_bench=false
5252
provision_nodes=false
5353
: Pass to skip MZBench installation on the nodes.
5454

55+
provision_workers=false
56+
: Pass to skip installation Workers on the nodes.
57+
5558
node_commit
5659
: Commit hash or branch name in the [MZBench repository](https://github.com/satori-com/mzbench/) that should be installed on the nodes.
5760

doc_old/cli.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ Optional params:
102102
`--provision_nodes false`
103103
: Skip MZBench installation on the nodes.
104104

105+
`--provision_workers false`
106+
: Skip Workers installation on the nodes.
107+
105108
`--node_commit=<commit>`
106109
: Commit hash or branch name in the MZBench repository pointing to the MZBench version to install on the nodes.
107110

lib/mzbench_api_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class MZBenchAPIException(Exception):
1919

2020
def start(host, script_file, script_content,
2121
node_commit = None, nodes = None, workers_per_node = None, deallocate_after_bench = None,
22-
provision_nodes = None, benchmark_name = None,
22+
provision_nodes = None, provision_workers = None, benchmark_name = None,
2323
cloud = None, tags = None, emails=[], includes=[], env={}, no_cert_check = False,
2424
exclusive = None
2525
):
@@ -41,6 +41,8 @@ def start(host, script_file, script_content,
4141
:type deallocate_after_bench: "true" or "false"
4242
:param provision_nodes: Install required software
4343
:type provision_nodes: "true" or "false"
44+
:param provision_workers: Install workers
45+
:type provision_workers: "true" or "false"
4446
:param benchmark_name: Set benchmark name
4547
:type benchmark_name: str or unicode
4648
:param cloud: Specify cloud provider to use
@@ -84,6 +86,8 @@ def start(host, script_file, script_content,
8486
params += [('deallocate_after_bench', deallocate_after_bench)]
8587
if provision_nodes is not None:
8688
params += [('provision_nodes', provision_nodes)]
89+
if provision_workers is not None:
90+
params += [('provision_workers', provision_workers)]
8791
if benchmark_name is not None:
8892
params += [('benchmark_name', benchmark_name)]
8993
if cloud is not None:

server/src/mzb_api_bench.erl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ init([Id, Params]) ->
111111
env => mzbl_script:normalize_env(generate_bench_env(Id, Params)),
112112
deallocate_after_bench => maps:get(deallocate_after_bench, Params),
113113
provision_nodes => ProvisionNodes,
114+
provision_workers => maps:get(provision_workers, Params),
114115
req_host => maps:get(req_host, Params),
115116
initial_user => maps:get(user, Params),
116117
director_host => undefined,

server/src/mzb_api_endpoints.erl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ parse_start_params(Req) ->
520520
{emulate_bench_crash, single_value, fun binary_to_bool/1, false},
521521
{deallocate_after_bench, single_value, fun binary_to_bool/1, true},
522522
{provision_nodes, single_value, fun binary_to_bool/1, true},
523+
{provision_workers, single_value, fun binary_to_bool/1, true},
523524
{benchmark_name, single_value, fun erlang:binary_to_list/1, undefined},
524525
{cloud, single_value, fun (N) -> erlang:binary_to_atom(N, latin1) end, undefined},
525526
{exclusive, single_value, fun erlang:binary_to_list/1, []},

server/src/mzb_api_provision.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
provision_nodes(Config, Logger) ->
1515
#{
1616
provision_nodes := ProvisionNodes,
17+
provision_workers := ProvisionWorkers,
1718
director_host := DirectorHost,
1819
worker_hosts := WorkerHosts,
1920
user_name := UserName,
@@ -38,10 +39,15 @@ provision_nodes(Config, Logger) ->
3839

3940
case ProvisionNodes of
4041
true ->
41-
ok = install_node(UniqHosts, Config, Logger),
42+
ok = install_node(UniqHosts, Config, Logger);
43+
_ ->
44+
ok
45+
end,
46+
case ProvisionWorkers of
47+
true ->
4248
install_workers(UniqHosts, Config, Logger, Env);
4349
_ ->
44-
ok = install_workers(UniqHosts, Config, Logger, Env)
50+
ok
4551
end,
4652
DirectorNode = nodename(director_sname(Config), 0),
4753
WorkerNodes = [nodename(worker_sname(Config), N) || N <- lists:seq(1, length(WorkerHosts))],

0 commit comments

Comments
 (0)