Skip to main content

Script to run command line programs in parallel

Project description

PAPPLY

Python wrapper to execute command line programs in parallel using multiprocessing.Pool

Description

A very simple wrapper around python's multiprocessing to be able to easily execute command line programs in parallel. It's implementation is inspired by GNU Parallel and Apply.

The basic idea is that one does not have to change much to the original command line to run tasks in parallel.

The first argument is interpreted as the command to execute multiple times, all other arguments are used as the inputs to the command.

Example usage

hello world: papply echo "Hello World" "Hello Papply"

compressing files with GNU gzip:

gzip *.txt

becomes:

papply gzip *.txt

converting images to jpg using ImageMagick's convert:

convert 1.png 1.jpg, convert 2.png 2.jpg, convert 2.png 2.jpg, ...

becomes:

papply "convert %F %n.jpg" *.png

Features

Template replacements

The following strings can appear in the command string (the first argument to papply). They will be replaced by:

  • %F: Full original input
  • %d: directory name (no trailing slash)
  • %f: file name with extension
  • %n: file name without extension
  • %e: extension (with leading .)
  • %z: empty string

Configuration

The basic configuration should work for most use-cases. I have not implemented command line options to papply itself on purpose. This is a choice to keep the interface as simple as possible.

If you want to override the default values you can create a papply.ini file. This file will be looked for first in the directory where you execute the command and second in your home directory. The following parameters can be changed:

  • num_cores: number of cores to use, default all available cores
  • overcommit_factor: how many threads per core to request, default 1
  • show_progress: print progress of the running jobs (yes, no, IfLong), default show progress if running a long time
  • long_duration: time in seconds to be considered long after which progress is shown, default 60

Any values that are not set explicitly will default to the standard value. There is an example ini file included in the distribution (papply.ini.example).

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

papply-0.1.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

papply-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file papply-0.1.1.tar.gz.

File metadata

  • Download URL: papply-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

File hashes

Hashes for papply-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dd88e6d7421555d569d5f4d318a09914536b678012dff39cfcca9281a001cdd3
MD5 0aad5e2dfe99a9cc3b5ea1c98fc2f836
BLAKE2b-256 8c4afccc5ba0237a5cb9ffe949a87ec2ec3fda87b41ae81ea20a7c90c68b0e04

See more details on using hashes here.

File details

Details for the file papply-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: papply-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

File hashes

Hashes for papply-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c7fc2212cc0fdad9a42f5ac520bd83b881b209b68466af78303d32f56bb8be4
MD5 d96bf5eaee5298506eee2f3d0bc8e2f0
BLAKE2b-256 4ad1e624376591deaa13486ae871071679624827454e553c1a02bd1bb2766b14

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