def populate(self): jobs = Job_Queue(5) def foo(): return 10 for x in range(10): jobs.append(self.Bucket( target=foo, args=[], kwargs={}, )) return jobs
def populate(self): jobs = Job_Queue(5) def foo(): return 10 for x in range(10): jobs.append(self.Bucket( target = foo, args = [], kwargs = {}, )) return jobs
def populate(self,queue_size=5,job_size=10,debug=False): jobs = Job_Queue(queue_size) jobs._debug = debug def foo(): return 10 for x in range(job_size): jobs.append(self.Bucket( target = foo, args = [], kwargs = {}, )) return jobs
"classifications": classifications }) while True: # Connection errs when the database is locked. # Keep trying until we get the lock. try: con = lite.connect(args.directory + '.db3', timeout=15) with con: cur = con.cursor() cur.execute("INSERT INTO Apps VALUES(?, ?)", (fname, jsonStr)) con.commit() return except: pass con = lite.connect(args.directory + '.db3', timeout=15) with con: cur = con.cursor() cur.execute("CREATE TABLE IF NOT EXISTS Apps(ID TEXT, CONTENTS TEXT)") con.commit() for fname in os.listdir(args.directory): if os.path.getsize(args.directory+"/"+fname) > 32000000: print("Warning: " + fname + " too large.") else: jobs.append(Process(target=scan, args = [fname], kwargs = {})) jobs.close() jobs.start()
while True: # Connection errs when the database is locked. # Keep trying until we get the lock. try: con = lite.connect(args.directory + '.db3', timeout=15) with con: cur = con.cursor() cur.execute("INSERT INTO Apps VALUES(?, ?)", (fname, jsonStr)) con.commit() return except: pass con = lite.connect(args.directory + '.db3', timeout=15) with con: cur = con.cursor() cur.execute("CREATE TABLE IF NOT EXISTS Apps(ID TEXT, CONTENTS TEXT)") con.commit() for fname in os.listdir(args.directory): if os.path.getsize(args.directory + "/" + fname) > 32000000: print("Warning: " + fname + " too large.") else: jobs.append(Process(target=scan, args=[fname], kwargs={})) jobs.close() jobs.start()