def run_workload(self, workload, result_dir_ts, run_iteration): """Creates workload object and runs a specific workload. :param workload: Dictionary of workload attributes defined by browbeat config :param result_dir_ts: Result directory timestamp :param run_iteration: Iteration for a specific run """ if workload["type"] == "rally": workloads = rally.Rally(self.config, result_dir_ts) elif workload["type"] == "rally-ovs": workloads = rally.Rally(self.config, result_dir_ts, openstack=False) elif workload["type"] == "shaker": workloads = shaker.Shaker(self.config, result_dir_ts) else: self.logger.error("Unknown workload provider: {}".format( workload["type"])) workloads.run_workload(copy.deepcopy(workload), run_iteration)
def post_process(self, cli): workloads = {} workloads['shaker'] = re.compile("shaker") workloads['perfkit'] = re.compile("perfkit") workloads['rally'] = re.compile("(?!perfkit)|(?!shaker)") """ Iterate through dir structure """ results = {} if os.path.isdir(cli.path): for dirname, dirnames, files in os.walk(cli.path): self.logger.info("Inspecting : %s" % dirname) results[dirname] = files else: self.logger.error("Path does not exist") return False """ Capture per-workload results """ workload_results = {} json = re.compile(r"\.json") if len(results) > 0: for path in results: for regex in workloads: if re.findall(workloads[regex], path): if regex not in workload_results: workload_results[regex] = [] for file in results[path]: if (re.findall(json, file) and 'result_index-es' not in file): workload_results[regex].append("{}/{}".format( path, file)) else: self.logger.error("Results are empty") return False """ Iterate through each workload result, generate ES JSON """ if len(workload_results) > 0: for workload in workload_results: if workload is "rally": rally_workload = rally.Rally(self.config) for file in workload_results[workload]: errors, results = rally_workload.file_to_json(file) if workload is "shaker": # Stub for Shaker. continue if workload is "perfkit": # Stub for PerfKit. continue