使用joblib并行时有多个tqdm进度条 [英] multiple tqdm progress bars when using joblib parallel

查看:458
本文介绍了使用joblib并行时有多个tqdm进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个功能:

def func(something):
    for j in tqdm(something):
        ...

由以下人员调用:

joblib.Parallel(n_jobs=4)((joblib.delayed)(s) for s in something_else)

现在,这将创建4个重叠的tqdm进度条.是否有可能获得4个独立更新的独立更新?

Now, this creates 4 overlapping tqdm progress bars. Is it possible to get 4 separate ones that update independently?

推荐答案

我被发送了讨论,其中提供了一种更为简洁的解决方案.我编写了一个快速性能测试,以确保该锁定不会导致线程彼此阻塞.即使每毫秒更新一次柱,也不会降低性能.我建议您改用该解决方案.

I was sent this discussion by a friend in which a much cleaner solution is provided. I wrote a quick performance test to make sure that the lock does not cause the threads to block each other. There was no performance hit even when updating bars every millisecond. I recommend that you use that solution instead.

上一个答案已被删除.

这篇关于使用joblib并行时有多个tqdm进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆