Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boydfd/tqdm_multi_thread
A tqdm multi-thread helper
https://github.com/boydfd/tqdm_multi_thread
Last synced: 1 day ago
JSON representation
A tqdm multi-thread helper
- Host: GitHub
- URL: https://github.com/boydfd/tqdm_multi_thread
- Owner: boydfd
- License: mit
- Created: 2019-08-10T11:09:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-12T03:15:02.000Z (over 5 years ago)
- Last Synced: 2024-10-28T22:43:02.173Z (16 days ago)
- Language: Python
- Size: 11.7 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A tqdm multi-thread helper
## example
```python
import threading
from concurrent.futures import ThreadPoolExecutor
import timefrom tqdm_multi_thread 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)
multi_thread_factory = TqdmMultiThreadFactory()
for i, url in enumerate(tasks, 1):
executor.submit(demo, multi_thread_factory, i, 100)
```