def run(self): this_dir=DirID(self.directory.name,self.depth) if this_dir in self.black_list: print "Skipping %s since blacklisted!" %this_dir return 0 self.depth+=1 the_test=Statistical_Tests[self.stat_test](self.test_threshold) #print "Test %s with threshold %s" %(self.stat_test,self.test_threshold) directory1=self.base1+"/"+self.directory.mother_dir+"/"+self.directory.name directory2=self.base2+"/"+self.directory.mother_dir+"/"+self.directory.name fetchers =(DirFetcher(self.comm1,directory1),DirFetcher(self.comm2,directory2)) for fetcher in fetchers: fetcher.start() for fetcher in fetchers: fetcher.join() contents1 = fetchers[0].contents contents2 = fetchers[1].contents set1= set(contents1.keys()) set2= set(contents2.keys()) walkers=[] self_directory_directories=self.directory.subdirs self_directory_comparisons=self.directory.comparisons contents_names=list(set1.intersection(set2)) for name in contents_names: content = contents1[name] if "dir" in content["type"]: #if this_dir not in DirWalker.white_list:continue subdir=Directory(name,join(self.directory.mother_dir,self.directory.name)) dirwalker=DirWalkerDB(self.comm1,self.comm2,self.base1,self.base2,subdir,self.depth, self.do_pngs,self.stat_test,self.test_threshold,self.black_list) dirwalker.start() walkers.append(dirwalker) n_threads=activeCount() if n_threads>5: #print >> stderr, "Threads that are running: %s. Joining them." %(n_threads) dirwalker.join() elif content["kind"]=="ROOT": # print directory1,name comparison=Comparison(name, join(self.directory.mother_dir,self.directory.name), literal2root(content["obj_as_string"],content["type"]), literal2root(contents2[name]["obj_as_string"],content["type"]), deepcopy(the_test), do_pngs=self.do_pngs) self_directory_comparisons.append(comparison) for walker in walkers: walker.join() walker_directory=walker.directory if not walker_directory.is_empty(): self_directory_directories.append(walker_directory)
def get_root_objects_recursive(self, url="", present_url=""): null_url = (len(url) == 0) if (not null_url): if len(present_url) == 0: present_url = url else: present_url += "_%s" % url if len(url) == 0: url = self.DQMpwd else: url = "/" + url url = url.replace(" ", "%20") #if not null_url: self.cd(url) objects = {} for name, description in self.ls("", True).items(): if "dir" in description["type"]: objects.update( self.get_root_objects_recursive(name, present_url)) self.cd("..") elif "ROOT" in description["kind"]: objects["%s_%s" % (present_url, name)] = literal2root( description["obj_as_string"], description["type"]) #if not null_url: self.cd("..") return objects
def get_root_objects(self, url=""): if len(url)==0: url=self.DQMpwd else: url=self.server+"/"+url url = url.replace(" ","%20") objects={} for name,description in self.ls(url,True).items(): if "dir" not in description["type"] and "ROOT" in description["kind"]: objects[name]=literal2root(description["obj_as_string"],description["type"]) return objects
def get_root_objects_list_recursive(self, url=""): null_url = (len(url)==0) if len(url)==0: url=self.DQMpwd else: url="/"+url url = url.replace(" ","%20") if not null_url: self.cd(url) objects=[] for name,description in self.ls("",True).items(): if "dir" in description["type"]: objects+=self.get_root_objects_list_recursive(name) self.cd("..") elif "ROOT" in description["kind"]: objects.append(literal2root(description["obj_as_string"],description["type"])) if not null_url: self.cd("..") return objects
def get_root_objects_recursive(self, url="",present_url=""): null_url = (len(url)==0) if (not null_url): if len(present_url)==0: present_url=url else: present_url+="_%s"%url if len(url)==0: url=self.DQMpwd else: url="/"+url url = url.replace(" ","%20") #if not null_url: self.cd(url) objects={} for name,description in self.ls("",True).items(): if "dir" in description["type"]: objects.update(self.get_root_objects_recursive(name,present_url)) self.cd("..") elif "ROOT" in description["kind"]: objects["%s_%s"%(present_url,name)]=literal2root(description["obj_as_string"],description["type"]) #if not null_url: self.cd("..") return objects