Skip to content
Permalink
Browse files

Refactor workloads

Move the perkit, rally and shaker workloads to their own submodule
in the browbeat namespace. So we dont pollute the browswer namespace
and make the code a bit more orgranized.

Change-Id: Ib833e86e71e595d336c27b08774f164e8f8c49bd
Signed-off-by: Charles Short <chucks@redhat.com>
  • Loading branch information...
zulcss committed Mar 18, 2019
1 parent 3833507 commit 318e0f5c7350be3abd3d0c3b4d34798e014e0e3b
@@ -20,7 +20,7 @@
import time
import browbeat.elastic
import browbeat.tools
import browbeat.workloadbase
from browbeat.workloads import base
from browbeat.config import load_browbeat_config
from browbeat.path import results_path

@@ -50,7 +50,7 @@ def run_iteration(_config, _cli_args, result_dir_ts, _logger, tools):
continue
_logger.info("{} workload {} is enabled".format(workload["type"], workload["name"]))
tools.run_workload(workload, result_dir_ts, 0)
browbeat.workloadbase.WorkloadBase.display_summary()
base.WorkloadBase.display_summary()
if terminate:
return

@@ -69,7 +69,7 @@ def run_complete(_config, _cli_args, result_dir_ts, _logger, tools):
continue
_logger.info("{} workload {} is enabled".format(workload["type"], workload["name"]))
tools.run_workload(workload, result_dir_ts, iteration)
browbeat.workloadbase.WorkloadBase.display_summary()
base.WorkloadBase.display_summary()
if terminate:
return

@@ -188,16 +188,16 @@ def main():
if terminate:
_logger.info("Browbeat execution halting due to user intervention")
sys.exit(1)
browbeat.workloadbase.WorkloadBase.dump_report(results_path, result_dir_ts)
base.WorkloadBase.dump_report(results_path, result_dir_ts)
_logger.info("Saved browbeat result summary to {}"
.format(os.path.join(results_path, "{}.report".format(result_dir_ts))))

if browbeat.workloadbase.WorkloadBase.failure > 0:
if base.WorkloadBase.failure > 0:
_logger.info(
"Browbeat finished with test failures, UUID: {}".format(browbeat.elastic.browbeat_uuid))
sys.exit(1)

if browbeat.workloadbase.WorkloadBase.index_failures > 0:
if base.WorkloadBase.index_failures > 0:
_logger.info("Browbeat finished with Elasticsearch indexing failures, UUID: {}"
.format(browbeat.elastic.browbeat_uuid))
sys.exit(2)
@@ -16,9 +16,9 @@
import re
import subprocess

from browbeat import perfkit
from browbeat import rally
from browbeat import shaker
from browbeat.workloads import perfkit
from browbeat.workloads import rally
from browbeat.workloads import shaker


class Tools(object):
@@ -36,13 +36,6 @@ def is_pingable(self, ip):
else:
return False

# Run command async from the python main thread, return Popen handle
def run_async_cmd(self, cmd):
FNULL = open(os.devnull, 'w')
self.logger.debug("Running command : %s" % cmd)
process = subprocess.Popen(cmd, shell=True, stdout=FNULL)
return process

# Run command, return stdout as result
def run_cmd(self, cmd):
self.logger.debug("Running command : %s" % cmd)
No changes.
@@ -20,7 +20,7 @@

class WorkloadBase(object):
__metaclass__ = abc.ABCMeta
logger = logging.getLogger('browbeat.workloadbase')
logger = logging.getLogger('browbeat.base.workloadbase')
success = 0
failure = 0
total_tests = 0
@@ -22,12 +22,12 @@
import browbeat.tools
from browbeat import elastic
from browbeat import grafana
from browbeat import workloadbase
from browbeat.path import get_overcloudrc
from browbeat.path import get_workload_venv
from browbeat.path import results_path
from browbeat.workloads import base

class PerfKit(workloadbase.WorkloadBase):
class PerfKit(base.WorkloadBase):

def __init__(self, config, result_dir_ts):
self.logger = logging.getLogger('browbeat.perfkit')
@@ -23,11 +23,11 @@
import browbeat.tools
from browbeat import elastic
from browbeat import grafana
from browbeat import workloadbase
from browbeat.path import get_workload_venv
from browbeat.path import results_path
from browbeat.workloads import base

class Rally(workloadbase.WorkloadBase):
class Rally(base.WorkloadBase):

def __init__(self, config, result_dir_ts):
self.logger = logging.getLogger('browbeat.rally')
@@ -22,13 +22,13 @@
import browbeat.tools
from browbeat import elastic
from browbeat import grafana
from browbeat import workloadbase
from browbeat.path import get_overcloudrc
from browbeat.path import get_workload_venv
from browbeat.path import results_path
from browbeat.workloads import base


class Shaker(workloadbase.WorkloadBase):
class Shaker(base.WorkloadBase):

def __init__(self, config, result_dir_ts):
self.logger = logging.getLogger('browbeat.shaker')

0 comments on commit 318e0f5

Please sign in to comment.
You can’t perform that action at this time.