multiprocessing.pool.map and function with two arguments

后端 未结 5 1813
臣服心动
臣服心动 2020-12-15 10:54

I am using multiprocessing.Pool()

here is what i want to Pool:

def insert_and_process(file_to_process,db):
    db = DAL(\"path_to_mysql\         


        
5条回答
  •  庸人自扰
    2020-12-15 11:28

    Using

    params=[(x,y) for x in X for y in Y]
    

    you create a full copy of x and y, and that may be slower than using

    from itertools import repeat
    P.map(insert_and_process,zip(file_list,repeat(db)))
    

提交回复
热议问题