HWRF  trunk@4391
Public Member Functions | List of all members
produtil.pipeline.Pipeline Class Reference

This class is a wrapper around launch and manage. More...

Detailed Description

This class is a wrapper around launch and manage.

It converts Runner objects to calls to "launch", and runs "manage" on the resulting processes.

Definition at line 564 of file pipeline.py.

Inheritance diagram for produtil.pipeline.Pipeline:

Public Member Functions

def __init__
 Pipeline constructor. More...
 
def __repr__ (self)
 Return a debug string representation of this Pipeline. More...
 
def send_signal (self, sig)
 Sends a signal to all children. More...
 
def terminate (self)
 Sends SIGTERM to all children. More...
 
def kill (self)
 Sends SIGKILL to all children. More...
 
def communicate
 Writes to input, reads from output, waits for child processes, etc. More...
 
def poll (self)
 Returns the exit status of the last element of the pipeline. More...
 
def to_string (self)
 Calls self.communicate(), and returns the stdout from the pipeline (self.outstring). More...
 
def outstring (self)
 The stdout from the pipeline. More...
 

Constructor & Destructor Documentation

def produtil.pipeline.Pipeline.__init__ (   self,
  runner,
  capture = False,
  logger = None,
  debug = False 
)

Pipeline constructor.

Parameters
runnerthe produtil.prog.Runner to convert
captureif True, capture the stdout of the runner
loggera logging.Logger for messages
debugif True, send debug messages

Definition at line 568 of file pipeline.py.

Member Function Documentation

def produtil.pipeline.Pipeline.__repr__ (   self)

Return a debug string representation of this Pipeline.

Definition at line 589 of file pipeline.py.

Referenced by produtil.prog.Runner.__str__().

def produtil.pipeline.Pipeline.communicate (   self,
  sleeptime = None 
)

Writes to input, reads from output, waits for child processes, etc.

This is just a wrapper around the manage() function. It will return immediately if self.communicate has already completed earlier.

Parameters
sleeptimethe sleep time in seconds between checks

Definition at line 653 of file pipeline.py.

Referenced by produtil.pipeline.Pipeline.to_string().

def produtil.pipeline.Pipeline.kill (   self)

Sends SIGKILL to all children.

Definition at line 644 of file pipeline.py.

def produtil.pipeline.Pipeline.outstring (   self)

The stdout from the pipeline.

Will be Null if the pipeline was redirected to a file, or if the constructor's capture option was not True.

Definition at line 693 of file pipeline.py.

Referenced by produtil.pipeline.Pipeline.to_string().

def produtil.pipeline.Pipeline.poll (   self)

Returns the exit status of the last element of the pipeline.

If the process died due to a signal, returns a negative number.

Definition at line 670 of file pipeline.py.

def produtil.pipeline.Pipeline.send_signal (   self,
  sig 
)

Sends a signal to all children.

Parameters
sigthe signal

Definition at line 633 of file pipeline.py.

Referenced by produtil.pipeline.Pipeline.kill(), and produtil.pipeline.Pipeline.terminate().

def produtil.pipeline.Pipeline.terminate (   self)

Sends SIGTERM to all children.

Definition at line 641 of file pipeline.py.

def produtil.pipeline.Pipeline.to_string (   self)

Calls self.communicate(), and returns the stdout from the pipeline (self.outstring).

The return value will be Null if the pipeline was redirected to a file or if the constructor's capture option was not True.

Definition at line 684 of file pipeline.py.


The documentation for this class was generated from the following file: