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

Class BasicWatcher

source code

object --+
         |
        BasicWatcher

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, follow=True)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
getSize(self)
Returns: the current size (in bytes) of the file
source code
 
start(self)
Reads the file and does the processing
source code
 
startHandle(self)
to be called before the program is started
source code
 
stopHandle(self)
called after the program has stopped
source code
 
tailingHandle(self)
called when the first line is output
source code
 
lineHandle(self, line)
called every time a new line is read
source code

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, follow=True)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

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.
  • follow - if the end of the file is reached wait for further input 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