我试图使用python的多道处理库,但我遇到了一些困难:多进程Python中的函数,进行了多个参数
def request_solr(limit=10, offset=10):
# build my facets here using limit and offset
# request solr
return response.json()
def get_list_event_per_user_per_mpm(limit=100):
nb_unique_user = get_unique_user()
print "Unique user: ", nb_unique_user
processor_pool = multiprocessing.Pool(4)
offset = range(0, nb_unique_user, limit)
list_event_per_user = processor_pool.map(request_solr(limit), offset)
return list_event_per_user
我不知道如何将第二参数传递给函数。我怎样才能使它工作。我有以下错误:
TypeError: 'dict' object is not callable
我有以下错误:PicklingError:不能咸菜<类型“功能”>:属性查找__builtin __功能失效 – mel
@mel啊,你必须在2.x的这只适用于3.x,我会将其添加到答案。 –