Add support for building images on CentOS
[yardstick.git] / yardstick / cmd / commands / 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 yardstick.benchmark.runners.base import Runner
13 from yardstick.common.utils import cliargs
14 from yardstick.cmd import print_hbar
15
16
17 class RunnerCommands(object):
18     '''Runner commands.
19
20        Set of commands to discover and display runner types.
21     '''
22
23     def do_list(self, args):
24         '''List existing runner types'''
25         types = Runner.get_types()
26         print_hbar(78)
27         print("| %-16s | %-60s" % ("Type", "Description"))
28         print_hbar(78)
29         for rtype in types:
30             print "| %-16s | %-60s" % (rtype.__execution_type__,
31                                        rtype.__doc__.split("\n")[0])
32         print_hbar(78)
33
34     @cliargs("type", type=str, help="runner type", nargs=1)
35     def do_show(self, args):
36         '''Show details of a specific runner type'''
37         rtype = Runner.get_cls(args.type[0])
38         print rtype.__doc__