def screenshots(self,db_value,threadpool): connection=Connection('localhost',27017) db=connection[db_value] domaines=db.new_domaines.distinct('domaine') i=0 main_thread = threading.currentThread() print "print "+ str(len(domaines))+ " screenshots" for domaine in domaines: i+=1 screen=Screenshots(domaines, 'screenshots/screenshots.js', 'screenshots/screenshots/'+db_value, domaine) screen.start() if i % int(threadpool)==0: for t in threading.enumerate(): if t is not main_thread: t.join()
def screenshots(self,db_value,threadpool): connection= MongoClient(host='localhost', port=27017) db=connection[db_value] domaines=db.new_domaines.distinct('domaine') i=0 main_thread = threading.currentThread() threadpools=[] print "print "+ str(len(domaines))+ " screenshots" for domaine in domaines: i+=1 screen=Screenshots(domaines, 'screenshots/screenshots.js', 'screenshots/screenshots/'+db_value, domaine) screen.start() threadpools.append(screen) if i % int(threadpool)== 0: for t in threadpools: t.join()
def screenshots(self, db_value, threadpool): connection = MongoClient(host='localhost', port=27017) db = connection[db_value] domaines = db.new_domaines.distinct('domaine') i = 0 main_thread = threading.currentThread() threadpools = [] print "print " + str(len(domaines)) + " screenshots" for domaine in domaines: i += 1 screen = Screenshots(domaines, 'screenshots/screenshots.js', 'screenshots/screenshots/' + db_value, domaine) screen.start() threadpools.append(screen) if i % int(threadpool) == 0: for t in threadpools: t.join()