[Erp5-report] r14339 - /erp5/trunk/utils/oood/logproc.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu May 3 17:25:14 CEST 2007


Author: bartek
Date: Thu May  3 17:25:14 2007
New Revision: 14339

URL: http://svn.erp5.org?rev=14339&view=rev
Log:
This scripts analyzes log produced by testOoodHighLoad.py
  and prints out names of files which failed to convert, status
  codes they produced, and number of times it happened.
  Useful mostly to see which documents your oood is not able
  to process (code 402).

Added:
    erp5/trunk/utils/oood/logproc.py   (with props)

Added: erp5/trunk/utils/oood/logproc.py
URL: http://svn.erp5.org/erp5/trunk/utils/oood/logproc.py?rev=14339&view=auto
==============================================================================
--- erp5/trunk/utils/oood/logproc.py (added)
+++ erp5/trunk/utils/oood/logproc.py Thu May  3 17:25:14 2007
@@ -1,0 +1,43 @@
+#!/usr/bin/env python
+#coding: iso-8859-2
+
+"""
+  This scripts analyzes log produced by testOoodHighLoad.py
+  and prints out names of files which failed to convert, status
+  codes they produced, and number of times it happened.
+  Useful mostly to see which documents your oood is not able
+  to process (code 402).
+"""
+
+import re
+lista = []
+temp = {}
+src = open('test.log')
+for line in src:
+  res = re.findall('Thread-(\d+)', line)
+  if len(res) == 1: # we have thread number
+    thr = res[0]
+    if not temp.has_key(thr):
+      temp[thr] = [None, None]
+    res = re.findall('/([^-]*)-', line)
+    if len(res) == 1: # we have file name
+      temp[thr][0] = res[0]
+    res = re.findall('got result: 200', line)
+    if len(res) == 1: # ok
+      temp[thr][1] = '200'
+    res = re.findall('got error code: (\d{3})', line)
+    if len(res) == 1: # we have error code
+      temp[thr][1] = res[0]
+    if temp[thr][0] is not None and temp[thr][1] is not None: # we have all, so record and reset
+      lista.append(temp[thr])
+      temp[thr] = [None, None]
+
+bads = [tuple(l) for l in lista if l[1] != '200']
+stat = {}
+for b in bads:
+  stat[b] = stat.setdefault(b, 0) + 1
+maxlen = max(len(k[0]) for k in stat)
+keys = stat.keys()
+keys.sort()
+for k in keys:
+  print k[0].ljust(maxlen), k[1], '(' + str(stat[k]), 'times)'

Propchange: erp5/trunk/utils/oood/logproc.py
------------------------------------------------------------------------------
    svn:executable = *




More information about the Erp5-report mailing list