Skip to content
Snippets Groups Projects
Commit 42aeab57 authored by an7s's avatar an7s
Browse files

Add hostname to gathered stats

Former-commit-id: e053eacd7c33a2654c2f8ac1a874b1e29f432bd0
parent 0906f205
No related branches found
No related tags found
No related merge requests found
......@@ -23,15 +23,16 @@ def extract_attribute(attribute_line):
# get stats one file at a time
stats = {}
for log_file_path in sys.argv[1:]:
ps_analyze_log = False
log_file = os.path.basename(log_file_path)
if not os.path.exists(log_file_path):
continue
if log_file == 'ps_analyze.log':
continue
ps_analyze_log = True
step_name= os.path.splitext(log_file)[0]
step_name = os.path.splitext(log_file)[0]
with open(log_file_path, 'r') as f:
for line in f:
......@@ -39,11 +40,16 @@ for log_file_path in sys.argv[1:]:
if not line or line is None:
continue
if re.search(ATTRIBUTE, line) or re.search(ATTRIBUTE2, line):
if ps_analyze_log:
if 'ATTRIBUTE start_time' in line or 'ATTRIBUTE end_time' in line or 'ATTRIBUTE hostname' in line:
(attribute_name, attribute_value) = extract_attribute(line.rstrip())
if not step_name in stats:
stats[step_name] = {}
stats[step_name][attribute_name] = attribute_value
elif re.search(ATTRIBUTE, line) or re.search(ATTRIBUTE2, line):
(attribute_name, attribute_value) = extract_attribute(line.rstrip())
if not step_name in stats:
stats[step_name] = {}
stats[step_name][attribute_name] = attribute_value
if stats:
......
......@@ -583,8 +583,10 @@ report_logs()
{
logfile=logs/ps_analyze.log
myhost=$(hostname)
echo "# ATTRIBUTE start_time=$ps_starttime" >> $logfile
echo "# ATTRIBUTE end_time=$ps_endtime" >> $logfile
echo "# ATTRIBUTE hostname=$myhost" >> $logfile
echo "# ATTRIBUTE peasoup_step_name=all_peasoup" >> $logfile
for i in $all_logs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment