Package PyFoam :: Package Execution :: Module BasicWatcher :: Class BasicWatcher
[hide private]
[frames] | no frames]

Class BasicWatcher

source code

object --+
         |
        BasicWatcher
Known Subclasses:
AnalyzedWatcher.AnalyzedWatcher, GnuplotRunner.GnuplotWatcher, StepAnalyzedWatcher.StepAnalyzedWatcher

Base class for watching the output of commands

Works like the UNIX-command 'tail -f <file>': the last lines of the file are output. If the file grows then these lines are output as they arrive

Instance Methods [hide private]
  __init__(self, filename, silent=False, tailLength=1000, sleep=0.1)
  getSize(self)
  start(self)
Reads the file and does the processing
  startHandle(self)
to be called before the program is started
  stopHandle(self)
called after the program has stopped
  tailingHandle(self)
called when the first line is output
  lineHandle(self, line)
called every time a new line is read

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, filename, silent=False, tailLength=1000, sleep=0.1)
(Constructor)

source code 
Parameters:
  • filename - name of the logfile to watch
  • silent - if True no output is sent to stdout
  • tailLength - number of bytes at the end of the fail that should be output. Because data is output on a per-line-basis
  • sleep - interval to sleep if no line is returned
Overrides: object.__init__

getSize(self)

source code 
Returns:
the current size (in bytes) of the file

start(self)

source code 
Reads the file and does the processing

startHandle(self)

source code 
to be called before the program is started

stopHandle(self)

source code 
called after the program has stopped

tailingHandle(self)

source code 
called when the first line is output

lineHandle(self, line)

source code 
called every time a new line is read