Skip to main content

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.

Version Downloads License

Installation

progrock may be installed via the Python package index with the tool of your choice. I prefer pip:

pip install progrock

Documentation

https://progrock.readthedocs.org

Requirements

There are no requirements outside of the Python standard library.

Screenshot

The following image shows the example code listing in action:

http://i.imgur.com/wi9MAdp.png

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)
        time.sleep(random.random())

processes = []

# Create the MultiProgress instance
with progrock.MultiProgress('Example') 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

progrock-0.2.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

progrock-0.2.1-py2.py3-none-any.whl (10.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file progrock-0.2.1.tar.gz.

File metadata

  • Download URL: progrock-0.2.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for progrock-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7ae4ffb6d336b255e41ec26793304bec24877cff8d79f3e05bd26623a0e89193
MD5 7ab94d7561321b98b8daa6f60a299c32
BLAKE2b-256 5237fe869124a4160ba7a9c73e74993ff0516ad22f29eb22b3e762469cda5efe

See more details on using hashes here.

File details

Details for the file progrock-0.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for progrock-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 94ae2cd71c6b4d9bf54a7a83f6d9b67270035b8e50145e1540e6c310913dc4ee
MD5 34c8b056addcad64fa9ed1bf3f29cd3a
BLAKE2b-256 b80f58afe26ebad15d85824dae49cdfa2131c062b1a3efbd314034ed29dd7b9d

See more details on using hashes here.

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