def start_tasks(): thread_pool = ThreadPool(size=20) store_list = load_stores() total_count = len(store_list) count = 0 for store in store_list: count += 1 task = FetcherTask(store=store, num=count, total=total_count) thread_pool.push_task(task) thread_pool.init_pool() thread_pool.start() print('Waiting Task Finished......') thread_pool.join()
def start_tasks(): stores = load_stores() thread_pool = ThreadPool(size=20) total = len(stores) pos = 0 for store in stores: pos += 1 task = UnderLoadSlotZeroTask(store=store, total=total, pos=pos) thread_pool.push_task(task) thread_pool.init_pool() thread_pool.start() print('Waiting for task exit!') thread_pool.join()
def main(): store_list = load_stores() thread_pool = ThreadPool(size=20) pos = 0 total = len(store_list) for store in store_list: pos += 1 task = SlotStateFetchTask(store, pos=pos, total=total) thread_pool.push_task(task) thread_pool.init_pool() thread_pool.start() print('Waiting for tasks exit!!!') thread_pool.join()
def main(): store_list = load_stores() thread_pool = ThreadPool(size=20) index = 0 total = len(store_list) for store in store_list: index += 1 task = CompensationDisableTask(store=store, index=index, total=total) thread_pool.push_task(task) thread_pool.init_pool() print('Starting tasks...') thread_pool.start() print('Waiting for task exit!') thread_pool.join()