aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/core
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2017-01-16 09:17:48 +0000
committerchenjiankun <chenjiankun1@huawei.com>2017-01-16 09:18:44 +0000
commitfa3afbcac13e1aa3ae9cc2977dcb4cd882112f6f (patch)
treeb9884b84f976f5d75d22b447d38f3c49e4a947fd /yardstick/benchmark/core
parentf036e9898a69f5041f9cde02e3652c29e2de1643 (diff)
Use """ to replace ''' in docstring
JIRA: YARDSTICK-525 For consistency, we always use """triple double quotes""" around docstrings. Change-Id: I47a20bbd8b55bc544b4841ea4006929af0a044ac Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'yardstick/benchmark/core')
-rw-r--r--yardstick/benchmark/core/__init__.py2
-rw-r--r--yardstick/benchmark/core/runner.py8
-rw-r--r--yardstick/benchmark/core/scenario.py8
-rw-r--r--yardstick/benchmark/core/task.py34
-rw-r--r--yardstick/benchmark/core/testcase.py10
5 files changed, 31 insertions, 31 deletions
diff --git a/yardstick/benchmark/core/__init__.py b/yardstick/benchmark/core/__init__.py
index 12c83f87e..161e448cc 100644
--- a/yardstick/benchmark/core/__init__.py
+++ b/yardstick/benchmark/core/__init__.py
@@ -32,7 +32,7 @@ class Param(object):
def print_hbar(barlen):
- '''print to stdout a horizontal bar'''
+ """print to stdout a horizontal bar"""
print("+"),
print("-" * barlen),
print("+")
diff --git a/yardstick/benchmark/core/runner.py b/yardstick/benchmark/core/runner.py
index 5f8132da8..b9c22cbc9 100644
--- a/yardstick/benchmark/core/runner.py
+++ b/yardstick/benchmark/core/runner.py
@@ -16,13 +16,13 @@ from yardstick.benchmark.core import print_hbar
class Runners(object):
- '''Runner commands.
+ """Runner commands.
Set of commands to discover and display runner types.
- '''
+ """
def list_all(self, args):
- '''List existing runner types'''
+ """List existing runner types"""
types = Runner.get_types()
print_hbar(78)
print("| %-16s | %-60s" % ("Type", "Description"))
@@ -33,6 +33,6 @@ class Runners(object):
print_hbar(78)
def show(self, args):
- '''Show details of a specific runner type'''
+ """Show details of a specific runner type"""
rtype = Runner.get_cls(args.type[0])
print(rtype.__doc__)
diff --git a/yardstick/benchmark/core/scenario.py b/yardstick/benchmark/core/scenario.py
index 15335afd4..a9d933faf 100644
--- a/yardstick/benchmark/core/scenario.py
+++ b/yardstick/benchmark/core/scenario.py
@@ -16,13 +16,13 @@ from yardstick.benchmark.core import print_hbar
class Scenarios(object):
- '''Scenario commands.
+ """Scenario commands.
Set of commands to discover and display scenario types.
- '''
+ """
def list_all(self, args):
- '''List existing scenario types'''
+ """List existing scenario types"""
types = Scenario.get_types()
print_hbar(78)
print("| %-16s | %-60s" % ("Type", "Description"))
@@ -33,6 +33,6 @@ class Scenarios(object):
print_hbar(78)
def show(self, args):
- '''Show details of a specific scenario type'''
+ """Show details of a specific scenario type"""
stype = Scenario.get_cls(args.type[0])
print(stype.__doc__)
diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py
index d9a85764a..d05117b47 100644
--- a/yardstick/benchmark/core/task.py
+++ b/yardstick/benchmark/core/task.py
@@ -34,13 +34,13 @@ LOG = logging.getLogger(__name__)
class Task(object): # pragma: no cover
- '''Task commands.
+ """Task commands.
Set of commands to manage benchmark tasks.
- '''
+ """
def start(self, args, **kwargs):
- '''Start a benchmark scenario.'''
+ """Start a benchmark scenario."""
atexit.register(atexit_handler)
@@ -101,7 +101,7 @@ class Task(object): # pragma: no cover
print("Done, exiting")
def _run(self, scenarios, run_in_parallel, output_file):
- '''Deploys context and calls runners'''
+ """Deploys context and calls runners"""
for context in Context.list:
context.deploy()
@@ -151,7 +151,7 @@ class Task(object): # pragma: no cover
class TaskParser(object): # pragma: no cover
- '''Parser for task config files in yaml format'''
+ """Parser for task config files in yaml format"""
def __init__(self, path):
self.path = path
@@ -181,8 +181,8 @@ class TaskParser(object): # pragma: no cover
return task_args, task_args_fnames
def parse_suite(self):
- '''parse the suite file and return a list of task config file paths
- and lists of optional parameters if present'''
+ """parse the suite file and return a list of task config file paths
+ and lists of optional parameters if present"""
LOG.info("\nParsing suite file:%s", self.path)
try:
@@ -226,7 +226,7 @@ class TaskParser(object): # pragma: no cover
return valid_task_files, valid_task_args, valid_task_args_fnames
def parse_task(self, task_id, task_args=None, task_args_file=None):
- '''parses the task file and return an context and scenario instances'''
+ """parses the task file and return an context and scenario instances"""
print("Parsing task config:", self.path)
try:
@@ -302,14 +302,14 @@ class TaskParser(object): # pragma: no cover
return cfg["scenarios"], run_in_parallel, meet_precondition
def _check_schema(self, cfg_schema, schema_type):
- '''Check if config file is using the correct schema type'''
+ """Check if config file is using the correct schema type"""
if cfg_schema != "yardstick:" + schema_type + ":0.1":
sys.exit("error: file %s has unknown schema %s" % (self.path,
cfg_schema))
def _check_precondition(self, cfg):
- '''Check if the envrionment meet the preconditon'''
+ """Check if the envrionment meet the preconditon"""
if "precondition" in cfg:
precondition = cfg["precondition"]
@@ -342,7 +342,7 @@ class TaskParser(object): # pragma: no cover
def atexit_handler():
- '''handler for process termination'''
+ """handler for process termination"""
base_runner.Runner.terminate_all()
if len(Context.list) > 0:
@@ -352,7 +352,7 @@ def atexit_handler():
def is_ip_addr(addr):
- '''check if string addr is an IP address'''
+ """check if string addr is an IP address"""
try:
ipaddress.ip_address(addr.encode('utf-8'))
return True
@@ -361,12 +361,12 @@ def is_ip_addr(addr):
def _is_same_heat_context(host_attr, target_attr):
- '''check if two servers are in the same heat context
+ """check if two servers are in the same heat context
host_attr: either a name for a server created by yardstick or a dict
with attribute name mapping when using external heat templates
target_attr: either a name for a server created by yardstick or a dict
with attribute name mapping when using external heat templates
- '''
+ """
host = None
target = None
for context in Context.list:
@@ -396,7 +396,7 @@ def _is_background_scenario(scenario):
def run_one_scenario(scenario_cfg, output_file):
- '''run one scenario using context'''
+ """run one scenario using context"""
runner_cfg = scenario_cfg["runner"]
runner_cfg['output_filename'] = output_file
@@ -444,7 +444,7 @@ def run_one_scenario(scenario_cfg, output_file):
def parse_nodes_with_context(scenario_cfg):
- '''paras the 'nodes' fields in scenario '''
+ """paras the 'nodes' fields in scenario """
nodes = scenario_cfg["nodes"]
nodes_cfg = {}
@@ -455,7 +455,7 @@ def parse_nodes_with_context(scenario_cfg):
def runner_join(runner):
- '''join (wait for) a runner, exit process at runner failure'''
+ """join (wait for) a runner, exit process at runner failure"""
status = runner.join()
base_runner.Runner.release(runner)
if status != 0:
diff --git a/yardstick/benchmark/core/testcase.py b/yardstick/benchmark/core/testcase.py
index 74304857f..92198bd91 100644
--- a/yardstick/benchmark/core/testcase.py
+++ b/yardstick/benchmark/core/testcase.py
@@ -20,17 +20,17 @@ from yardstick.definitions import YARDSTICK_ROOT_PATH
class Testcase(object):
- '''Testcase commands.
+ """Testcase commands.
Set of commands to discover and display test cases.
- '''
+ """
def __init__(self):
self.test_case_path = YARDSTICK_ROOT_PATH + 'tests/opnfv/test_cases/'
self.testcase_list = []
def list_all(self, args):
- '''List existing test cases'''
+ """List existing test cases"""
try:
testcase_files = os.listdir(self.test_case_path)
@@ -48,7 +48,7 @@ class Testcase(object):
return True
def show(self, args):
- '''Show details of a specific test case'''
+ """Show details of a specific test case"""
testcase_name = args.casename[0]
testcase_path = self.test_case_path + testcase_name + ".yaml"
try:
@@ -104,7 +104,7 @@ class Testcase(object):
return description, installer_type, deploy_scenarios
def _format_print(self, testcase_list):
- '''format output'''
+ """format output"""
print_hbar(88)
print("| %-21s | %-60s" % ("Testcase Name", "Description"))