From 56b252240100f0ee714aac9c0543f675fc374a40 Mon Sep 17 00:00:00 2001 From: Tanyy Date: Wed, 15 Mar 2017 12:10:29 +0800 Subject: [PATCH] [analyzer] update get_execute_time() we cannot get execute time if head node not a worker. so, we shall use one of the ceph mon node to get execute time . --- analyzer/analyzer.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/analyzer/analyzer.py b/analyzer/analyzer.py index 52b601f..137d5d2 100644 --- a/analyzer/analyzer.py +++ b/analyzer/analyzer.py @@ -328,14 +328,14 @@ def format_result_for_visualizer(self, data): def get_execute_time(self): dest_dir = self.dest_dir cf = config.Config(dest_dir+"/conf/all.conf") - head = '' - head = cf.get("head") - file_path = os.path.join(dest_dir,"raw",head,head+"_process_log.txt") - if head != '': - if os.path.exists(os.path.join(dest_dir,"raw",head)): - for file_path in os.listdir(os.path.join(dest_dir,"raw",head)): + mon = '' + mon = cf.get("list_mon").split(",")[0] + file_path = os.path.join(dest_dir,"raw",mon,mon+"_process_log.txt") + if mon != '': + if os.path.exists(os.path.join(dest_dir,"raw",mon)): + for file_path in os.listdir(os.path.join(dest_dir,"raw",mon)): if file_path.endswith("_process_log.txt"): - with open("%s/%s" % (os.path.join(dest_dir,"raw",head),file_path), "r") as f: + with open("%s/%s" % (os.path.join(dest_dir,"raw",mon),file_path), "r") as f: lines = f.readlines() if len(lines) != 0 and lines != None: str_time = ''