Fix retrieving "options" section in "scenario"
[yardstick.git] / yardstick / benchmark / core / runner.py
1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 """ Handler for yardstick command 'runner' """
11
12 from __future__ import absolute_import
13
14 import prettytable
15
16 from yardstick.benchmark.runners.base import Runner
17
18
19 class Runners(object):  # pragma: no cover
20     """Runner commands.
21
22        Set of commands to discover and display runner types.
23     """
24
25     def list_all(self, *args):
26         """List existing runner types"""
27         types = Runner.get_types()
28         runner_table = prettytable.PrettyTable(['Type', 'Description'])
29         runner_table.align = 'l'
30         for rtype in types:
31             runner_table.add_row([rtype.__execution_type__,
32                                   rtype.__doc__.split("\n")[0]])
33         print(runner_table)
34
35     def show(self, args):
36         """Show details of a specific runner type"""
37         rtype = Runner.get_cls(args.type[0])
38         print(rtype.__doc__)