Skip to content

tqdm.write under multiprocessing.Pool make bars overlapped #680

@yihengli

Description

@yihengli
  • I have visited the source website, and in particular
    read the known issues
  • I have searched through the issue tracker for duplicates
  • I have mentioned version numbers, operating system and
    environment, where applicable:
    import tqdm, sys
    print(tqdm.__version__, sys.version, sys.platform)

Env

4.26.0 3.7.2 (default, Dec 29 2018, 00:00:04)
[Clang 4.0.1 (tags/RELEASE_401/final)] darwin . (MacOS . 10.13.4)

Reproduce

from time import sleep
from tqdm import tqdm
from multiprocessing import Pool


def foo(a):
    tqdm.write("Working on %d" % a)
    sleep(0.5)
    return a

if __name__ == '__main__':
    with Pool(2) as p:
        list(tqdm(p.imap(foo, range(20)), total=20))

screen shot 2019-02-21 at 5 43 07 pm

This might be relevant to #407

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions