From 186e4ea28a6cb7857835fcb20ea90c6ad06884a5 Mon Sep 17 00:00:00 2001 From: ben-spiller Date: Fri, 18 Oct 2019 14:12:29 +0100 Subject: [PATCH] 3.1 release: - Fix bug resulting in error when log analysis takes more than 10s. - Add supprot for .gz files. - Add special-case to parse apama-ctrl-* log files that don't end with .log. --- .travis.yml | 2 +- CHANGELOG.rst | 5 +++-- apamax/log_analyzer.py | 13 +++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 941d88b..051f73c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ deploy: skip_cleanup: true overwrite: true on: - branch: master + branch: release condition: $DEPLOY_JOB = true name: "v" diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8805a01..7cc269a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,8 @@ 3.1 --- - -... +- Fix bug resulting in error when log analysis takes more than 10s. +- Add supprot for .gz files. +- Add special-case to parse apama-ctrl-* log files that don't end with .log. 3.0 --- diff --git a/apamax/log_analyzer.py b/apamax/log_analyzer.py index a7386af..7998752 100644 --- a/apamax/log_analyzer.py +++ b/apamax/log_analyzer.py @@ -19,7 +19,7 @@ """ -__version__ = '3.1.dev' +__version__ = '3.1' __date__ = '2019-10-18' __author__ = "Apama community" __license__ = "Apache 2.0" @@ -456,16 +456,16 @@ def processFile(self, file): if lastpercent < threshold: self.handleFilePercentComplete(file=file, percent=threshold) self.handleFileFinished(file=file) + + duration = time.time()-duration + if duration > 10: + log.info('Completed analysis of %s in %s', os.path.basename(self.currentpath), (('%d seconds'%duration) if duration < 120 else ('%0.1f minutes' % (duration/60)))) self.currentlineno = -1 self.__currentfilehandle = None self.currentpath, self.currentpathbytes = None, 0 self.currentfile = file - duration = time.time()-duration - if duration > 10: - log.info('Completed analysis of %s in %s', os.path.basename(self.currentpath), (('%d seconds'%duration) if duration < 120 else ('%0.1f minutes' % (duration/60)))) - def handleFileFinished(self, file, **extra): for w in self.writers: w.closeFile() @@ -1464,6 +1464,7 @@ def main(self, args): archiveextensions['.xz'] = lzma archiveextensions['.bz2'] = bz2 archiveextensions['.gzip'] = gzip + archiveextensions['.gz'] = gzip logpaths = set() def raiseOnError(e): @@ -1477,7 +1478,7 @@ def addDirectory(root): dirnames.append('logs') continue for fn in filenames: - if (fn.endswith('.log') or fn.endswith('.out')) and not fn.endswith('.input.log') and not fn.startswith('iaf'): + if (fn.endswith('.log') or fn.endswith('.out') or fn.startswith('apama-ctrl-')) and not fn.endswith('.input.log') and not fn.startswith('iaf'): logpaths.add(dirpath+os.sep+fn) else: log.info('Ignoring file (filename doesn\'t look like a correlator log): %s', dirpath+os.sep+fn)