Skip to main content

A multi-progressbar implementation to complement multiprocessing.Process

Project description

A multi-progressbar implementation to complement multiprocessing.Process.

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.

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.1.0.tar.gz (3.0 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for progrock-0.1.0.tar.gz
Algorithm Hash digest
SHA256 57269c8db468f312b968c4761b241f4d3e62e28ff3ceab0567164c592268cb31
MD5 129cb21596d42d2e1d4c6c3a99b0f2cd
BLAKE2b-256 e219a74f629fc7acd0e8bfaee604168f1095c99663568d35691f6d8e72aae9ae

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