A multi-progressbar implementation to complement multiprocessing.Process
Project description
The progrock.MultiProgress class is used in conjunction with the methods exposed at the module level such as progrock.increment to create a full-screen experience allowing the user to track the progress of individual processes as they perform their work.
Installation
progrock may be installed via the Python package index with the tool of your choice. I prefer pip:
pip install progrock
Documentation
Requirements
There are no requirements outside of the Python standard library.
Screenshot
The following image shows the example code listing in action:
Example
The following example will create a process for each CPU core on the system that it is run on, displaying the MultiProgress screen. The child processes will iterate 100 times, updating their progress bar and then sleeping up to 1 second.
import progrock
import random
def example_runner(ipc_queue):
# Update the processes status in its progress box
progrock.set_status(ipc_queue, 'Running')
# Increment the progress bar, sleeping up to one second per iteration
for iteration in range(1, 101):
progrock.increment(ipc_queue)
progrock.increment_app(ipc_queue)
time.sleep(random.random())
processes = []
# Create the MultiProgress instance
steps = multiprocessing.cpu_count() * 100
with MultiProgress('Example', steps=steps) as progress:
# Spawn a process per CPU and append it to the list of processes
for proc_num in range(0, multiprocessing.cpu_count()):
processes.append(progress.new_process(example_runner))
# Wait for the processes to run
while any([p.is_alive() for p in processes]):
time.sleep(1)
Version History
Available at https://progrock.readthedocs.org
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file progrock-0.3.0.tar.gz
.
File metadata
- Download URL: progrock-0.3.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09aafed57975b4e3b3b0e9a2d9baddac492120a5c98953d0470264b1d1d3055f |
|
MD5 | fb1b86cd19708adc8f65a7bfecd8334c |
|
BLAKE2b-256 | d9dcf2646e5d6cdb35658c7797d34594f77faf2e8a00dd03a6bda754ebe8cf88 |
File details
Details for the file progrock-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: progrock-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2acf12de10694158517386e110e911b88eb4e6e9e24c41615bd796ddc19f8ae |
|
MD5 | 10fa46958981bffdcd3062149c5236f1 |
|
BLAKE2b-256 | 4ba22715319e8566e7cd191807ee772e3fed120f5565279cf666e010621d22a7 |