Skip to main content

A tqdm multi-thread helper

Project description

A tqdm multi-thread helper

example

import threading
from concurrent.futures import ThreadPoolExecutor
import time

from tqdm_multi_thread_factory import TqdmMultiThreadFactory


def demo(factory, position, total):
    with factory.create(position, total) as progress:
        for _ in range(0, total, 5):
            progress.update(5)
            time.sleep(0.001 * (position % 5 + 1))


with ThreadPoolExecutor(max_workers=20) as executor:
    tasks = range(100)
    lock = threading.Lock()
    multi_thread_factory = TqdmMultiThreadFactory()
    for i, url in enumerate(tasks, 1):
        executor.submit(demo, multi_thread_factory, i, 100)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tqdm_multi_thread-0.4-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page