python - 进度条starmap_async多处理python
问题描述
我已经构建了一个多处理器来加速进程(300.000 个参数),但是如果它显示类似的进度条会很好,这样我就可以跟踪进度。我在 stackoverflow 上搜索了一个合适的解决方案,但是找不到类似的问题。是否可以在 starmap_async 上使用进度方法?如果没有,有什么好的选择?
import multiprocessing as mp
def origins(G, x, y):
return ox.get_nearest_node(G, (y, x))
x = [buildings.geometry[i].centroid.y for i in list(range(len(buildings)))]
y = [buildings.geometry[i].centroid.y for i in list(range(len(buildings)))]
params = ((G, orig, dest) for orig, dest in zip(y, x))
# create a pool of worker processes
pool = mp.Pool(4)
# map the function/parameters to the worker processes
sma = pool.starmap_async(origins, params)
# get the results, close the pool, wait for worker processes to all exit
routes = sma.get()
pool.close()
pool.join()
有人可以帮我吗?
解决方案
推荐阅读
- java - 使用 Facebook 登录的应用程序在开发中不起作用!它只是加载和关闭-Android Studio
- javascript - 通过 POST 请求发送文件流时出错
- r - 如何使用变量名中的多个正则表达式对数据框进行子集化?
- android - 如何修复没有这样的 NoSuchMethodError 颤振 tabView?
- python - 并行运行 luigi 任务
- excel - BOF 或 EOF 为 True ,或当前记录已被删除
- python - 为 geopandas 图生成图例
- php - 将 html mysql 表导入到 php 中。大数字在excel文件中转换为指数
- java - 当我在其他活动中使用 mqtt 客户端时,他们向我显示错误
- angular - 如何在两次上传相同文件时正确清除 ngx-material-file-input 以检测更改