/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes | Static Public Attributes
pickler::Pickler Class Reference

List of all members.

Public Member Functions

def persist
def retrieve
def dretrieve
def checkpoint
def __init__
def load
def save
def reload

Public Attributes

 path

Static Public Attributes

tuple persist = classmethod(persist)
tuple retrieve = classmethod(retrieve)
tuple dretrieve = classmethod(dretrieve)
tuple checkpoint = classmethod(checkpoint)

Detailed Description

Definition at line 27 of file pickler.py.


Constructor & Destructor Documentation

def pickler::Pickler::__init__ (   self,
  path 
)
:param path: for pickling 

Definition at line 78 of file pickler.py.

00079                             :
00080         """
00081         :param path: for pickling 
00082         """
00083         self.path = path


Member Function Documentation

def pickler::Pickler::persist (   cls,
  obj,
  path 
)
:param obj: to be persisted
:param path: in which to persist
:return: `Pickler` instance whick records the path

Definition at line 30 of file pickler.py.

00031                                :
00032         """
00033         :param obj: to be persisted
00034         :param path: in which to persist
00035         :return: `Pickler` instance whick records the path
00036         """ 
00037         if not path:return None
00038         pk = cls(path)
00039         pk.save(obj)
        return pk
def pickler::Pickler::retrieve (   cls,
  path 
)

Definition at line 42 of file pickler.py.

00043                            :
00044         if not path:return None
00045         pk = cls(path)
        return pk.load()
def pickler::Pickler::dretrieve (   cls,
  keys,
  path_ 
)
:param keys: list of keys
:param path_: function that returns path from the key
:return: dict of retrieved objects keyed by provided keys

Definition at line 48 of file pickler.py.

00049                                      :
00050         """
00051         :param keys: list of keys
00052         :param path_: function that returns path from the key
00053         :return: dict of retrieved objects keyed by provided keys
00054         """
00055         paths = map(path_, keys)
00056         objs = map(lambda _:cls.retrieve(_), paths )
        return dict(zip(keys,objs))
def pickler::Pickler::checkpoint (   cls,
  obj,
  path 
)
compare obj with prior before persisting

Definition at line 59 of file pickler.py.

00060                                   :
00061         """
00062         compare obj with prior before persisting
00063         """
00064         if os.path.exists(path):
00065             prior = cls.retrieve(path)
00066             if obj == prior:
00067                 log.info("prior %s checkpoint matches current" % path )
00068                 log.info("     current %r " % (obj) ) 
00069             else:
00070                 log.info("prior %s checkpoint differes from current" % path )
00071                 log.info("     prior   %r " % (prior ) ) 
00072                 log.info("     current %r " % (obj) ) 
00073         else:
00074             log.info("no prior %s checkpoint" % path) 
00075             log.info("     current %r " % (obj ) ) 
        cls.persist( obj,  path)
def pickler::Pickler::load (   self)

Definition at line 84 of file pickler.py.

00085                   :
00086         if os.path.exists(self.path):
00087             log.info("reading from %s " % self.path )
00088             with open(self.path,"r") as fp:
00089                 prior = pickle.load(fp)
00090             return prior    
00091         return None

def pickler::Pickler::save (   self,
  obj 
)

Definition at line 92 of file pickler.py.

00093                         :
00094         with open(self.path,"w") as fp:
00095             log.info("writing to %s " % self.path )
00096             pickle.dump( obj , fp ) 

def pickler::Pickler::reload (   self)

Definition at line 97 of file pickler.py.

00098                     :
00099         return self.retrieve( self.path ) 
00100 


Member Data Documentation

tuple pickler::Pickler::persist = classmethod(persist) [static]

Definition at line 40 of file pickler.py.

tuple pickler::Pickler::retrieve = classmethod(retrieve) [static]

Definition at line 46 of file pickler.py.

tuple pickler::Pickler::dretrieve = classmethod(dretrieve) [static]

Definition at line 57 of file pickler.py.

tuple pickler::Pickler::checkpoint = classmethod(checkpoint) [static]

Definition at line 76 of file pickler.py.

Definition at line 80 of file pickler.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:57:25 for DybDbi by doxygen 1.7.4