鉴于:
with concurrent.futures.ProcessPoolExecutor(max_workers=(2*multiprocessing.cpu_count()+1)) as executor:
for netelement in DOC['code']['info']['dev']:
job = executor.submit(bgp_communities.do_lookup, netelement)
job.add_done_callback(functools.partial(bgp_communities.do_data_wrangling, DOC))
是否可以将第二个函数(如bgp_communities.do_data_wrangling
)作为参数传递给future
的回调?在
你的问题不太清楚。但如果您希望在任务完成时调用多个函数,只需对
job.add_done_callback
进行另一次调用。在参见docs:
相关问题 更多 >
编程相关推荐