Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create_list_of_attribute_dicts():
- ...
- return list_of_dicts
- for each_dict in list_of_dicts:
- instance = SC(each_dict)
- p = mp.Process(target=instance.queen_bee(),args=(each_dict,))
- p.start()
- ...
- ...
- pool = mp.Pool()
- jobs = pool.map(SC.queen_bee(),list_of_dicts)
- from multiprocessing import Pool as ThreadPool
- # ...
- def parallel_function(list_of_dictionaries,threads=20):
- thread_pool = ThreadPool(threads)
- results = thread_pool.map(SC.queen_bee() ,list_of_dictionaries)
- thread_pool.close()
- thread_pool.join()
- return results
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement