CMS 3D CMS Logo

Public Member Functions | Public Attributes

dqm_interfaces::DirWalkerDB Class Reference

Inherits threading::Thread.

List of all members.

Public Member Functions

def __init__
def run

Public Attributes

 base2
 black_list
 comm1
 comm2
 depth
 directory
 do_pngs
 stat_test
 test_threshold

Detailed Description

An interface to the DQM document db. It is threaded to compensate the 
latency introduced by the finite response time of the server.

Definition at line 392 of file dqm_interfaces.py.


Constructor & Destructor Documentation

def dqm_interfaces::DirWalkerDB::__init__ (   self,
  comm1,
  comm2,
  base1,
  base2,
  directory,
  depth = 0,
  do_pngs = True,
  stat_test = "KS",
  test_threshold = .5,
  black_list = [] 
)

Definition at line 396 of file dqm_interfaces.py.

00397                                                                                                                            :
00398     Thread.__init__(self)
00399     self.comm1 = deepcopy(comm1)
00400     self.comm2 = deepcopy(comm2)
00401     self.base1,self.base2 = base1,base2
00402     self.directory = directory
00403     self.depth=depth
00404     self.do_pngs=do_pngs
00405     self.test_threshold=test_threshold
00406     self.stat_test=stat_test
00407     self.black_list=black_list
00408     # name of the thread
00409     self.name+="_%s" %directory.name
  

Member Function Documentation

def dqm_interfaces::DirWalkerDB::run (   self)

Definition at line 410 of file dqm_interfaces.py.

00411                :
00412     
00413     this_dir=DirID(self.directory.name,self.depth)
00414     if this_dir in self.black_list: 
00415       print "Skipping %s since blacklisted!" %this_dir
00416       return 0 
00417     
00418     self.depth+=1
00419     
00420     the_test=Statistical_Tests[self.stat_test](self.test_threshold)
00421     #print "Test %s with threshold %s" %(self.stat_test,self.test_threshold)
00422     
00423     directory1=self.base1+"/"+self.directory.mother_dir+"/"+self.directory.name
00424     directory2=self.base2+"/"+self.directory.mother_dir+"/"+self.directory.name
00425     
00426     fetchers =(DirFetcher(self.comm1,directory1),DirFetcher(self.comm2,directory2))
00427     for fetcher in fetchers:
00428       fetcher.start()
00429     for fetcher in fetchers:  
00430       fetcher.join()
00431     
00432     contents1 = fetchers[0].contents
00433     contents2 = fetchers[1].contents
00434     set1= set(contents1.keys())
00435     set2= set(contents2.keys())  
00436     
00437     walkers=[]
00438     self_directory_directories=self.directory.subdirs
00439     self_directory_comparisons=self.directory.comparisons
00440     contents_names=list(set1.intersection(set2))
00441 
00442     for name in contents_names:
00443       content = contents1[name]
00444       if "dir" in content["type"]:
00445         #if this_dir not in DirWalker.white_list:continue              
00446         subdir=Directory(name,join(self.directory.mother_dir,self.directory.name))        
00447         dirwalker=DirWalkerDB(self.comm1,self.comm2,self.base1,self.base2,subdir,self.depth,
00448                               self.do_pngs,self.stat_test,self.test_threshold,self.black_list)
00449         dirwalker.start()
00450         walkers.append(dirwalker)
00451         n_threads=activeCount()
00452         if n_threads>5:
00453           #print >> stderr, "Threads that are running: %s. Joining them." %(n_threads)    
00454           dirwalker.join()
00455       elif content["kind"]=="ROOT":
00456 #       print directory1,name
00457         comparison=Comparison(name,
00458                               join(self.directory.mother_dir,self.directory.name),
00459                               literal2root(content["obj_as_string"],content["type"]),
00460                               literal2root(contents2[name]["obj_as_string"],content["type"]),
00461                               deepcopy(the_test),
00462                               do_pngs=self.do_pngs)
00463         self_directory_comparisons.append(comparison)
00464     
00465     
00466     for walker in walkers:
00467       walker.join()
00468       walker_directory=walker.directory
00469       if not walker_directory.is_empty():
00470         self_directory_directories.append(walker_directory)
00471         
00472 #-------------------------------------------------------------------------------


Member Data Documentation

Definition at line 396 of file dqm_interfaces.py.

Definition at line 396 of file dqm_interfaces.py.

Definition at line 396 of file dqm_interfaces.py.

Definition at line 396 of file dqm_interfaces.py.

Definition at line 396 of file dqm_interfaces.py.

Definition at line 396 of file dqm_interfaces.py.

Definition at line 396 of file dqm_interfaces.py.

Definition at line 396 of file dqm_interfaces.py.

Definition at line 396 of file dqm_interfaces.py.