/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
DybDbi::mapr::MaprMonitor Class Reference

List of all members.

Public Member Functions

def __init__
def load
def save
def compare
def __repr__
def __call__

Public Attributes

 path

Detailed Description

Definition at line 177 of file mapr.py.


Constructor & Destructor Documentation

def DybDbi::mapr::MaprMonitor::__init__ (   self,
  path 
)

Definition at line 178 of file mapr.py.

00179                              :
00180         self.path = path 


Member Function Documentation

def DybDbi::mapr::MaprMonitor::load (   self)

Definition at line 181 of file mapr.py.

00182                   :
00183         if os.path.exists(self.path):
00184             log.info("reading prior persisted maps from %s " % self.path )
00185             with open(self.path,"r") as fp:
00186                 prior = pickle.load(fp)
00187             return prior    
00188         return None

def DybDbi::mapr::MaprMonitor::save (   self,
  maph 
)

Definition at line 189 of file mapr.py.

00190                          :
00191         with open(self.path,"w") as fp:
00192             log.info("writing map to %s " % self.path )
00193             pickle.dump( maph , fp ) 

def DybDbi::mapr::MaprMonitor::compare (   self,
  amap,
  bmap 
)

Definition at line 194 of file mapr.py.

00195                                   :
00196         ak = set(amap.keys())
00197         bk = set(bmap.keys())
00198         ik = ak.intersection(bk)
00199         log.info("comparing current and prior maps for the %s common keys" % len(ik) )
00200         for i,k in enumerate(ik):
00201             a = amap[k]
00202             b = bmap[k]
00203             #log.info("i %s k %s a\n%s\nb\n%s\n" % ( i, k, a, b ))
00204             if a!=b:
00205                 log.warn("change in map for seqno %s \n%s\n%s\n" % (k,a,b) )
00206                 self[k] = dict(a=a,b=b)

def DybDbi::mapr::MaprMonitor::__repr__ (   self)

Definition at line 207 of file mapr.py.

00208                       :
00209         return "%s : %s differnces for seqnos %s " % ( self.__class__.__name__ , len(self), self.keys() )

def DybDbi::mapr::MaprMonitor::__call__ (   self,
  amap 
)
only writes if no prior existing map, thus to bless a change delete and rerun

Definition at line 210 of file mapr.py.

00211                              :
00212         """
00213         only writes if no prior existing map, thus to bless a change delete and rerun
00214         """
00215         bmap = self.load()        
00216         if bmap:
00217            self.compare(amap,bmap)
00218         else:
00219            self.save(amap)
00220 
00221 


Member Data Documentation

Definition at line 178 of file mapr.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:24 for DybDbi by doxygen 1.7.4