HWRF  trunk@4391
Public Member Functions | List of all members
scripts.exhwrf_output.Deliverer Class Reference

A utility class for delivering files. More...

Detailed Description

A utility class for delivering files.

This implements most of the functionality of the exhwrf_output.

Definition at line 57 of file exhwrf_output.py.

Inheritance diagram for scripts.exhwrf_output.Deliverer:

Public Member Functions

def __init__ (self, logger, conf)
 Creates a new Deliverer with the specified logging.Logger and HWRFConfig. More...
 
def log
 Gets the logging.Logger for this Deliverer. More...
 
def __setitem__ (self, key, value)
 Sets a key in an internal dict of values used for string formatting. More...
 
def __getitem__ (self, key)
 Gets a key from the hash of internal values used for string formatting, or raises KeyError if no such key is found. More...
 
def failures (self)
 The number of failed deliveries. More...
 
def reset (self)
 Resets the number of failures to zero. More...
 
def conf (self)
 The hwrf.config.HWRFConfig object for this Deliverer. More...
 
def deliver_file (self, workfile, comfile=None, from_com=False, optional=False, kwargs)
 Delivers one file. More...
 

Constructor & Destructor Documentation

def scripts.exhwrf_output.Deliverer.__init__ (   self,
  logger,
  conf 
)

Creates a new Deliverer with the specified logging.Logger and HWRFConfig.

Parameters
loggera logging.Logger for log messages
confan hwrf.config.HWRFConfig for configuration info

Definition at line 60 of file exhwrf_output.py.

Member Function Documentation

def scripts.exhwrf_output.Deliverer.__getitem__ (   self,
  key 
)

Gets a key from the hash of internal values used for string formatting, or raises KeyError if no such key is found.

Parameters
keythe desired key

Definition at line 82 of file exhwrf_output.py.

def scripts.exhwrf_output.Deliverer.__setitem__ (   self,
  key,
  value 
)

Sets a key in an internal dict of values used for string formatting.

Parameters
keythe string formatting key
valuewhat to replace the key with in string replacement

Definition at line 76 of file exhwrf_output.py.

def scripts.exhwrf_output.Deliverer.conf (   self)

The hwrf.config.HWRFConfig object for this Deliverer.

Definition at line 95 of file exhwrf_output.py.

Referenced by scripts.exhwrf_output.Deliverer.deliver_file().

def scripts.exhwrf_output.Deliverer.deliver_file (   self,
  workfile,
  comfile = None,
  from_com = False,
  optional = False,
  kwargs 
)

Delivers one file.

Delivers the specified work area file to the specified com location. OR, if from_com=True, it does the opposite: deliver from com to the workfile. If the com location is not specified, a suitable default will be chosen. If optional=True, deliver_file will ignore the file if it is missing. Otherwise, a missing file counts as a failure in the internal failure counter. Additional keyword arguments are sent to conf.strinterp. If the workfile is a relative path, it is relative to the WORKhwrf directory.

When delivering to COM (from_com=False, the default), the workfile can instead be a Product, in which case the Product.location and .available are checked for availability information. When delivering from COM (from_com=True), the workfile must be a string path.

Parameters
workfilethe file in the work area
comfilethe file in the COM directory
from_comif True, deliver from com to work, if False, do the opposite
optionalif True, and the file is missing, return True
kwargsadditional keyword arguments passed on to produtil.fileop.deliver_file()
Returns
True on successful delivery, False on delivery failure. If the file could not be delivered, but optional=True, then True is returned.

Definition at line 99 of file exhwrf_output.py.

Referenced by scripts.exhwrf_output.Deliverer.conf().

def scripts.exhwrf_output.Deliverer.failures (   self)

The number of failed deliveries.

Definition at line 88 of file exhwrf_output.py.

def scripts.exhwrf_output.Deliverer.log (   self,
  sublog = None 
)

Gets the logging.Logger for this Deliverer.

Parameters
sublogIf "sublog" is provided, a new logging.Logger is created for that subdomain of this Deliverer's logging domain.

Definition at line 69 of file exhwrf_output.py.

Referenced by scripts.exhwrf_output.Deliverer.deliver_file(), and hwrf.coupling.CouplingStatus.set().

def scripts.exhwrf_output.Deliverer.reset (   self)

Resets the number of failures to zero.

Definition at line 91 of file exhwrf_output.py.


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