soweego icon indicating copy to clipboard operation
soweego copied to clipboard

tqdm bar doesn't stick to the bottom of the screen

Open marfox opened this issue 6 years ago • 2 comments

You should be able to grasp the bug when gathering datasets from Wikidata.

marfox avatar May 23 '19 09:05 marfox

I looked a bit more into this and was able to find out that the issue is happening when we have logging happening in a separate thread.

A simple example is the following code, which generates as output the image below:

def func_mult(x):
    logger.info('processing %s', x)
    time.sleep(1)
    return x

array = list(range(6))

with multiprocessing.Pool(2) as pool:
    for xx in tqdm.tqdm(pool.imap_unordered(func_mult, array), total=len(array)):
        logger.info('getting result: %s', xx)

image

Note that the getting result messages are printed correctly (above the bar) since they're being issued from the current thread. On the other hand, the processing messages issues on other threads don't respect the bar and are added to the bottom of the screen. These are the ones that cause the bar to slide up.

tupini07 avatar May 23 '19 11:05 tupini07

An issue has been opened directly on the tqdm project: https://github.com/tqdm/tqdm/issues/749

Work on this issue will be paused until there are any updates.

tupini07 avatar May 23 '19 12:05 tupini07