def getAll(): global data pool = Pool(size=10) pool.add_tasks([(getEach, (row, )) for row in data]) pool.run() temp_list = list(pool.output_queue.queue) temp_list.sort(key=lambda e: e['編號']) data = temp_list
def getAll(): global data pool = Pool(size=10) pool.add_tasks([ ( getEach, (i, id,)) for i, id in enumerate(id_list)]) pool.run() temp_list = list(pool.output_queue.queue) temp_list.sort(key=lambda e: e['編號']) data = temp_list
def __init__(self, num_workers, worker_name): threading.Thread.__init__(self, name=worker_name) self.pool = Pool(num_workers=num_workers, name=worker_name) if os.name == 'nt': self.in_progress_jobs = [] self.lock = threading.RLock() else: self.in_progress_jobs = Manager().list() self.lock = Manager().Lock()
def getAllCount(): global data pool = Pool(size=10) pool.add_tasks([(getCount, (row, )) for row in data]) pool.run() temp_list = list(pool.output_queue.queue) temp_list = [returnTemp(each) for each in temp_list] temp_list.sort(key=lambda e: e['編號']) data = temp_list
def getAll(): global data pool = Pool(size=10) pool.add_tasks([(getEach, ( i, url, )) for i, url in enumerate(link_list)]) pool.run() temp_list = list(pool.output_queue.queue) temp_list.sort(key=lambda e: e['編號']) data = temp_list print(len(list(pool.error_queue.queue)))
def getAll(): global data, temp_list pool = Pool(size=10) pool.add_tasks([(getEach, ( i, temp, )) for i, temp in enumerate(temp_list[0:500])]) pool.run() temp_list = list(pool.output_queue.queue) temp_list.sort(key=lambda e: e['編號']) data = temp_list print('Error: ', len(list(pool.error_queue.queue)))
def start_pool(self): self.logger.info("Sumo Logic vRops - Starting Thread Pool\n") self.pool = Pool(self.pool_size) self.pool_started = True self.logger.info("Sumo Logic vRops - Pool Size:::" + str(self.pool_size) + "\n")