diff --git a/execution/lib/cli_parser.py b/execution/lib/cli_parser.py index a9c51139fd9d444c6d915c570093475e655c9417..63896efe9fb8791389fa702674a20fb2316b800f 100644 --- a/execution/lib/cli_parser.py +++ b/execution/lib/cli_parser.py @@ -1,6 +1,7 @@ import argparse import os + def env_list_default(env, tf): """ Makes a list from an environment string. @@ -17,7 +18,7 @@ def key_values_to_dict(kvs): """ my_dict = {} for kv in kvs: - k,v = kv.split("=") + k, v = kv.split("=") my_dict[k] = v return my_dict @@ -29,15 +30,19 @@ def env_dict_default(env): v = os.environ.get(env) if v is not None: return key_values_to_dict(v.split(',')) + else: + return dict() class StoreDictKeyPair(argparse.Action): - def __init__(self, option_strings, dest, nargs=None, **kwargs): - self._nargs = nargs - super(StoreDictKeyPair, self).__init__(option_strings, dest, nargs=nargs, **kwargs) - def __call__(self, parser, namespace, values, option_string=None): - my_dict = key_values_to_dict(values) - setattr(namespace, self.dest, my_dict) + def __init__(self, option_strings, dest, nargs=None, **kwargs): + self._nargs = nargs + super(StoreDictKeyPair, self).__init__( + option_strings, dest, nargs=nargs, **kwargs) + + def __call__(self, parser, namespace, values, option_string=None): + my_dict = key_values_to_dict(values) + setattr(namespace, self.dest, my_dict) def default_parser(description): @@ -81,7 +86,8 @@ def default_parser(description): help='Only resets the environment. Ignores all other parameters') parser.add_argument('--prometheus', metavar='<URL>', - default=os.environ.get('PROMETHEUS_BASE_URL', 'http://localhost:9090'), + default=os.environ.get( + 'PROMETHEUS_BASE_URL', 'http://localhost:9090'), help='Defines where to find the prometheus instance') parser.add_argument('--path', metavar='<path>', @@ -96,6 +102,7 @@ def default_parser(description): help='Defines the environment variables for the UC') return parser + def benchmark_parser(description): """ Parser for the overall benchmark execution @@ -125,6 +132,7 @@ def benchmark_parser(description): help='The benchmarking search strategy. Can be set to default, linear-search or binary-search') return parser + def execution_parser(description): """ Parser for executing one use case