Package PyFoam :: Package LogAnalysis :: Module LogAnalyzerApplication
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.LogAnalysis.LogAnalyzerApplication

 1  """Wraps an Analyzer""" 
 2   
 3  import sys 
 4   
 5  from os import path,mkdir 
 6   
7 -class LogAnalyzerApplication(object):
8 """ 9 Wrapper for the Analyzer Classes 10 - Builds a directory for their output 11 - name is derived from the logfile-name 12 - anounces the directory to them 13 - starts the analyzer 14 """ 15
16 - def __init__(self,analyze):
17 """ @param analyze: The analyzer""" 18 self.analyzer=analyze
19
20 - def run(self,pfad=None):
21 """ runs the analyzer 22 @param pfad: path to the logfile, if no path is given it is 23 taken from the command line""" 24 if pfad==None: 25 fn=sys.argv[1] 26 else: 27 fn=pfad 28 29 pfad=path.abspath(fn) 30 dn=path.dirname(pfad) 31 oDir=path.join(dn,path.basename(pfad)+"_analyzed") 32 if not path.exists(oDir): 33 mkdir(oDir) 34 35 self.analyzer.setDirectory(oDir) 36 37 fh=open(fn,'r') 38 self.analyzer.analyze(fh)
39