Yurik has uploaded a new change for review. https://gerrit.wikimedia.org/r/168986
Change subject: log2dfs fix pattern match picker ...................................................................... log2dfs fix pattern match picker Change-Id: I698d2a5a0d2549dfda016ce712cebe2c88fbfcba --- M scripts/log2dfs.py M scripts/logprocessor.py 2 files changed, 9 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/analytics/zero-sms refs/changes/86/168986/1 diff --git a/scripts/log2dfs.py b/scripts/log2dfs.py index 59aa394..a4d7b51 100644 --- a/scripts/log2dfs.py +++ b/scripts/log2dfs.py @@ -68,12 +68,12 @@ class LogConverter(LogProcessor): - def __init__(self, settingsFile='settings/log2dfs.json', logDatePattern=False): + def __init__(self, filePattern=False, settingsFile='settings/log2dfs.json'): super(LogConverter, self).__init__(settingsFile, 'w2h') - if not logDatePattern: - logDatePattern = r'\d\d\d\d\d\d\d\d' - self.logFileRe = re.compile(unicode(logDatePattern), re.IGNORECASE) + if not filePattern: + filePattern = r'\d\d\d\d\d\d\d\d' + self.logFileRe = re.compile(unicode(filePattern), re.IGNORECASE) self.dateRe = re.compile(r'(201\d-\d\d-\d\dT\d\d):\d\d:\d\d(\.\d+)?') self.urlRe = re.compile(r'^(https?)://([^/]+)([^?#]*)(.*)', re.IGNORECASE) @@ -82,7 +82,7 @@ safePrint('Processing log files') for f in os.listdir(self.pathLogs): - if not self.logFileRe.match(f): + if not self.logFileRe.search(f): continue logFile = os.path.join(self.pathLogs, f) statFile = os.path.join(self.pathCache, f) @@ -235,5 +235,5 @@ if __name__ == '__main__': - # LogConverter(logDatePattern=(sys.argv[1] if len(sys.argv) > 1 else False)).manualRun() - LogConverter(logDatePattern=(sys.argv[1] if len(sys.argv) > 1 else False)).safeRun() + # LogConverter(filePattern=(sys.argv[1] if len(sys.argv) > 1 else False)).manualRun() + LogConverter(filePattern=(sys.argv[1] if len(sys.argv) > 1 else False)).safeRun() diff --git a/scripts/logprocessor.py b/scripts/logprocessor.py index 36c7548..0e425b1 100644 --- a/scripts/logprocessor.py +++ b/scripts/logprocessor.py @@ -125,6 +125,8 @@ self.onSettingsLoaded() def normalizePath(self, path, relToSettings=True): + if not path: + return False if not os.path.isabs(path) and relToSettings: path = os.path.join(os.path.dirname(self.settingsFile), path) path = os.path.abspath(os.path.normpath(path)) -- To view, visit https://gerrit.wikimedia.org/r/168986 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I698d2a5a0d2549dfda016ce712cebe2c88fbfcba Gerrit-PatchSet: 1 Gerrit-Project: analytics/zero-sms Gerrit-Branch: master Gerrit-Owner: Yurik <yu...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits