1
1
#!/usr/bin/env python
2
- """mzbench CLI interface
2
+ from __future__ import print_function
3
+ try :
4
+ import mzbench_server_marker
5
+ assert (mzbench_server_marker )
6
+ server_functions = True
7
+ except ImportError :
8
+ server_functions = False
9
+
10
+ # Client-only functions
11
+ doc_acc = """mzbench CLI interface
3
12
4
13
Usage:
5
- mzbench clean
6
- mzbench start_server [--config=<config>]
7
- mzbench stop_server
8
- mzbench restart_server [--config=<config>]
9
14
mzbench [--host=<host>] (start|run)
10
15
[--nodes=<nodes>|--workers_per_node=<workers_per_node>]
11
16
[--nodes_file=<filename>]
@@ -22,18 +27,25 @@ Usage:
22
27
mzbench [--host=<host>] status [--wait] <bench_id>
23
28
mzbench [--host=<host>] stop <bench_id>
24
29
mzbench [--host=<host>] log <bench_id>
25
- mzbench [--host=<host>] data [(--target=<name>...)] [--format=(csv|json)] <bench_id>
30
+ mzbench [--host=<host>] data [(--target=<name>...)] [--format=(csv|json)] <bench_id>"""
31
+
32
+ if server_functions :
33
+ doc_acc += """
34
+ mzbench clean
35
+ mzbench start_server [--config=<config>]
36
+ mzbench stop_server
37
+ mzbench restart_server [--config=<config>]
26
38
mzbench run_local <script> [--env=<name=value>...]
27
39
mzbench validate <script> [--env=<name=value>...]
28
40
mzbench list_templates
29
41
mzbench new_worker [--template=<template>] <name>
30
- mzbench selfcheck
42
+ mzbench selfcheck"""
43
+
44
+ doc_acc += """
31
45
mzbench -h | --help
32
46
33
47
Options:
34
48
-h, --help Show this help
35
- --skip_install Skip stage with building and deploying RPMs
36
- --tests <tests> Execute only the specified tests
37
49
--host <host> Specify host providing mzbench api. Alternatively,
38
50
you can set environment variable MZBENCH_API_HOST.
39
51
--nodes <nodes> Specify either an amount of nodes to be allocated or a
@@ -77,14 +89,14 @@ Options:
77
89
Specify cloud provider to use. If not set server will use
78
90
first available provider.
79
91
--env <name=value>
80
- Pass a variable to script
92
+ Pass a variable to script"""
93
+
94
+ if server_functions :
95
+ doc_acc += """
81
96
--template <template>
82
97
Choose a template for new worker, default is 'empty'
83
98
--config <config>
84
- Configuation file to use
85
- """
86
-
87
- from __future__ import print_function
99
+ Configuation file to use"""
88
100
89
101
from shutil import copytree
90
102
import csv
@@ -504,7 +516,7 @@ def apply_args(fun, kwargs):
504
516
return fun (** dict ((k , get_arg (k , kwargs )) for k in argnames ))
505
517
506
518
def main ():
507
- args = docopt .docopt (__doc__ , version = '0.1.0' )
519
+ args = docopt .docopt (doc_acc , version = '0.1.0' )
508
520
augment_args (args )
509
521
510
522
known_commands = [k for k in args
0 commit comments