HWRF  trunk@4391
Public Member Functions | Public Attributes | List of all members
hwrf.tracker.TrackerView Class Reference

This Task is used by the delivery script executed by the gettrk program itself. More...

Detailed Description

This Task is used by the delivery script executed by the gettrk program itself.

It derives directly from Task and has no knowledge of the surrounding HWRF workflow: it only knows about the local track filename, destination filenames and final forecast hours for each destination file.

Definition at line 519 of file tracker.py.

Inheritance diagram for hwrf.tracker.TrackerView:
produtil.datastore.Task produtil.datastore.Datum

Public Member Functions

def __init__ (self, dstore, taskname, fhr, fmin, logger=None, kwargs)
 Creates a TrackerView for the specified datastore and taskname. More...
 
def run (self)
 Performs the actual delivery. More...
 
- Public Member Functions inherited from produtil.datastore.Task
def __init__ (self, dstore, taskname, logger=None, kwargs)
 Task constructor. More...
 
def jlogfile (self)
 returns the jlogfile logger. More...
 
def postmsg (self, message, args, kwargs)
 same as produtil.log.jlogger.info() More...
 
def setstate (self, val)
 Sets the state of this job. More...
 
def getstate (self)
 Returns the job state. More...
 
def strstate (self)
 A string representation of the job state. More...
 
def gettaskname (self)
 Returns the task name part of the database ID, which is the same as the prodname. More...
 
def products (self, args, kwargs)
 Iterate over the products this task produces. More...
 
def log (self)
 Returns the logger object for this task. More...
 
def clean (self)
 Cleans up any unneeded data used by this task. More...
 
def unrun (self)
 Undoes the effect of run(). More...
 
def run (self)
 Performs the work this Task should do and generates all products. More...
 
def is_completed (self)
 Is this task complete? More...
 
def completed (self)
 Read-only property: is this task completed? Same as is_completed() More...
 
def runpart (self)
 Run some of this task's work, deliver some products. More...
 
- Public Member Functions inherited from produtil.datastore.Datum
def __init__ (self, dstore, prodname, category, meta=None, cache=30, location=None, kwargs)
 Datum constructor. More...
 
def __enter__ (self)
 Acquires this object's thread lock. More...
 
def __exit__ (self, etype, evalue, traceback)
 Releases this object's thread lock. More...
 
def validate (self)
 Validates this object's Datastore, prodname and category. More...
 
def getid (self)
 Returns the database ID of this datum. More...
 
def getdatastore (self)
 Returns the datastore of this datum. More...
 
def transaction (self)
 Creates, but does not lock, a Transaction for this datum's datastore. More...
 
def getprodtype (self)
 Returns the product type of this Datum. More...
 
def getprodname (self)
 Returns the product name part of the database ID. More...
 
def getcategory (self)
 Returns the product category part of the database ID. More...
 
def getlocation (self)
 Returns the "location" field of this Datum's database entry. More...
 
def setlocation (self, v)
 Sets the "location" field of this Datum's database entry. More...
 
def __hash__ (self)
 Integer hash function. More...
 
def __str__ (self)
 Human-readable description of this Datum. More...
 
def __repr__ (self)
 Python code-like description of this Datum. More...
 
def __cmp__ (self, other)
 Compares two Datums' prodnames and categories. More...
 
def set_loc_avail (self, loc, avail)
 Sets the location and availability of this Datum in a single transaction. More...
 
def update (self)
 Discards all cached metadata and refreshes it from the Datastore. More...
 
def __getitem__ (self, k)
 Returns the value of the specified metadata key or raises KeyError. More...
 
def meta
 Return the value of a metadata key. More...
 
def get
 Alias for self.meta() Returns the value of the specified metadata key or returns default if it is unset. More...
 
def __setitem__ (self, k, v)
 Sets the value of the specified metadata key. More...
 
def __delitem__ (self, k)
 Deletes the specified metadata key, which must not be "available" or "location". More...
 
def __contains__ (self, k)
 Determines if a metadata key is set. More...
 
def iteritems (self)
 Iterates over all metadata (key,value) pairs for this Datum, including "available" and "location". More...
 

Public Attributes

 fhr
 Last expected forecast hour.
 
 fmin
 Last expected forecast minute.
 

Additional Inherited Members

- Properties inherited from produtil.datastore.Task
 state
 Read-write property: the job state. More...
 
 taskname
 Read-only property: the name of this task. More...
 
- Properties inherited from produtil.datastore.Datum
 prodname = property(getprodname,None,None,)
 Read-only property, an alias for getprodname(): the product name part of the database ID. More...
 
 category = property(getcategory,None,None,)
 Read-only property, an alias for getcategory(), the category name part of the database ID. More...
 
 prodtype
 Read-only property, an alias for getprodtype(), the product type. More...
 
 did
 Read-only property, an alias for getid(). More...
 
 dstore
 Read-only property, an alias for getdatastore(), the Datastore in which this Datum resides. More...
 
 location
 Read-write property, an alias for getlocation() and setlocation(). More...
 

Constructor & Destructor Documentation

def hwrf.tracker.TrackerView.__init__ (   self,
  dstore,
  taskname,
  fhr,
  fmin,
  logger = None,
  kwargs 
)

Creates a TrackerView for the specified datastore and taskname.

It will deliver a file subsetted to the specified forecast hour and minute.

Parameters
dstorethe produtil.datastore.Datastore for database info
tasknamethe task name in the database
fhr,fminthe last expected forecast time
loggerThe given logger is used to log messages.
kwargsOther keywoard arguments are passed to the produtil.datastore.Task.__init__() constructor.

Definition at line 525 of file tracker.py.

Member Function Documentation

def hwrf.tracker.TrackerView.run (   self)

Performs the actual delivery.

Queries the database for all products for this task that match certain requirements. All of this task's RawATCFProduct products are delivered, as well as any CleanATCFSubsetProduct products that have the right forecast time. Type name is obtained from the database's prodtype column in the PRODUCTS table. It is assumed that the products for this task have a database id beginning with "taskname::" where "taskname" is this task's name. These assumptions match what is done by the TrackerTask.

Definition at line 547 of file tracker.py.

Referenced by produtil.datastore.Task.runpart().


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