Skip to content

Commit

Permalink
Merge pull request #889 from beardeddog/elkstagetimes
Browse files Browse the repository at this point in the history
moved elk log call to after stage end
  • Loading branch information
Bill Weide committed Dec 17, 2019
2 parents 052e2f5 + e87e8fa commit 9b5453a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions pylib/Tools/Executor/sequential.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,12 @@ def execute_sections(self, testDef):
if 'stderr' in stageLog and isinstance(stageLog['stderr'], str):
stageLog['stderr'] = stageLog['stderr'].split("\n")

# Log results for section
testDef.logger.logResults(disp_title, stageLog, testDef)

# Print end of section
testDef.logger.stage_end_print(disp_title, stageLog)

# Log results for section
testDef.logger.logResults(disp_title, stageLog, testDef)

if testDef.options['stop_on_fail'] is not False and stageLog['status'] != 0:
print("Section " + stageLog['section'] + ": Status " + str(stageLog['status']))
try:
Expand Down
17 changes: 10 additions & 7 deletions pylib/Utilities/Logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,16 @@ def log_to_elk(self, result, logtype, testDef):

if logtype == 'mtt-sec':
# convert comamands, list of dicts into a dictionary
result['commands'] = {"command{}".format(i):c for i,c in enumerate(self.execmds_stash)}
self.execmds_stash = []
if self.execmds_stash:
result['commands'] = {"command{}".format(i):c for i,c in enumerate(self.execmds_stash)}
self.execmds_stash = []

# convert parameters, list of lists into a dictionary
result['parameters'] = { p[0]:p[1] for p in result['parameters'] }
if 'parameters' in result:
result['parameters'] = { p[0]:p[1] for p in result['parameters'] }

# convert profile, list of lists into a dictionary
if 'profile' in result:
# convert profile, list of lists into a dictionary
result['profile'] = { k:' '.join(v) for k,v in list(result['profile'].items()) }

if testDef.options['elk_debug']:
Expand Down Expand Up @@ -226,9 +229,9 @@ def stage_end_print(self, stagename, log):
self.verbose_print(to_print)
self.verbose_print("STATUS OF [%s] IS %d" % (stagename, log['status']))
self.verbose_print("")
log['time'] = (stage_end-self.stage_start[stagename]).total_seconds()
log['time_start'] = self.stage_start[stagename]
log['time_end'] = stage_end
log['elapsed'] = (stage_end-self.stage_start[stagename]).total_seconds()
log['starttime'] = self.stage_start[stagename]
log['endtime'] = stage_end
self.current_section = None

def verbose_print(self, string, timestamp=None):
Expand Down

0 comments on commit 9b5453a

Please sign in to comment.