| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DybPython::dbcas::DD Class Reference

List of all members.

Public Member Functions

def Compare
def get_prep
def dif_
def __call__
def assert_
def __repr__

Static Public Attributes

tuple Compare = classmethod(Compare)
tuple prep = property(get_prep)
tuple dif_ = classmethod( dif_ )

Detailed Description

Compares directories contained cascade mysqldumps 
after first replacing the times from todays dates 
avoiding inevitable validity insert time differences 

Successful comparison Requires the *DbiTest* and *DybDbiTest* dumps 
to be created on the same UTC day.

Definition at line 264 of file dbcas.py.


Member Function Documentation

def DybPython::dbcas::DD::Compare (   cls,
  cas,
  dir,
  cfdir,
  reference = False 
)

Definition at line 267 of file dbcas.py.

00274                                                           :
00275         if not cfdir and reference == True:
00276             cfdir = dir 
00277         dir    = os.path.expandvars(dir)   
00278         cfdir  = os.path.expandvars(cfdir)   
        print "DD.Compare comparing %s with %s reference %s " % ( dir, cfdir, reference ) 

def DybPython::dbcas::DD::get_prep (   self  ) 

Initially this just obscured the times in UTC todays date 
(which appears in the Vld table INSERTDATE column) to 
allow comparison between DbiTest and DybDbiTest runs done on the same UTC day

However, now that are extending usage of the MYSQLDUMP reference comparisons 
to dumps of DBWriter created DB from different days, need to obscure todays date fully 

Definition at line 281 of file dbcas.py.

00282                                       :
00283             if not con.ascii:
00284                 dd = DD(dbno=dbno, dir=dir , cfdir=cfdir , reference=reference )
00285                 print dd.assert_() 
00286     Compare = classmethod(Compare)
00287 
00288     def get_prep(self):
00289         """
00290         Initially this just obscured the times in UTC todays date 
00291         (which appears in the Vld table INSERTDATE column) to 
00292         allow comparison between DbiTest and DybDbiTest runs done on the same UTC day
00293 
        However, now that are extending usage of the MYSQLDUMP reference comparisons 

def DybPython::dbcas::DD::dif_ (   cls,
  a,
  b,
  prep 
)

Definition at line 296 of file dbcas.py.

00297                                     :
00298             today = datetime.utcnow().strftime("%Y-%m-%d")
            self._prep = Prep({re.compile("%s \d{2}:\d{2}:\d{2}" % today ):"....-..-..  ..:..:.." }) 

def DybPython::dbcas::DD::__call__ (   self  ) 

Definition at line 301 of file dbcas.py.

00303                                 :
00304         from difflib import unified_diff
00305         return unified_diff( map(prep,open(a).readlines()), map(prep,open(b).readlines()) , a, b )
00306     dif_ = classmethod( dif_ )
00307 
00308     def __call__(self):
00309         ref = ".ref" if self['reference'] else "" 
00310         a = os.path.join( self['dir'],   "%s.sql" % self['dbno'] )
00311         b = os.path.join( self['cfdir'], "%s.sql%s" % ( self['dbno'] , ref ) ) 
00312         print "DD a", a
00313         print "DD b", b
00314 
00315         assert os.path.exists(a) , a 
00316         if self['reference']:
00317             if not os.path.exists(b):
00318                 print "b %s does not exist, blessing a %s to reference " % ( b, a )  
                shutil.copyfile( a, b)

def DybPython::dbcas::DD::assert_ (   self  ) 

Definition at line 319 of file dbcas.py.

00320             :
00321             assert os.path.exists(b) , b
00322         p = self.prep
        #p = string.strip   # to see some differences

def DybPython::dbcas::DD::__repr__ (   self  ) 

Definition at line 323 of file dbcas.py.

00326                      :
00327         assert len([l for l in self()]) == 0 , self
00328         return self
00329    
00330     def __repr__(self):
00331         return "\n".join(["%s %s" % ( self.__class__.__name__, dict.__repr__(self)) ] + [l for l in self()])
00332 


Member Data Documentation

tuple DybPython::dbcas::DD::Compare = classmethod(Compare) [static]

Definition at line 279 of file dbcas.py.

tuple DybPython::dbcas::DD::prep = property(get_prep) [static]

Definition at line 294 of file dbcas.py.

tuple DybPython::dbcas::DD::dif_ = classmethod( dif_ ) [static]

Definition at line 299 of file dbcas.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 Mon Apr 11 20:13:02 2011 for DybPython by doxygen 1.4.7