Skip to main content

Execute shell command lines in parallel on SGE/PBS clusters

Project description

Execute shell command lines in parallel on SGE/PBS clusters

Travis CI build status

qbatch is a tool for executing commands in parallel across a compute cluster. It takes as input a list of commands (shell command lines or executable scripts) in a file or piped to qbatch. The list of commands are divided into arbitrarily sized chunks which are submitted as jobs to the cluster either as individual submissions or an array. Each job runs the commands in its chunk in parallel. Commands can also be run locally on systems with no cluster capability.

Installation

$ pip install qbatch

Dependencies

qbatch requires python (2 or 3) and GNU Parallel. For Torque/PBS and gridengine clusters, qbatch requires job submission access via the qsub command.

Environment variable defaults

qbatch supports several environment variables to customize defaults for your local system.

$ export QBATCH_PPJ=12                   # requested processors per job
$ export QBATCH_CHUNKSIZE=$QBATCH_PPJ    # commands to run per job
$ export QBATCH_CORES=$QBATCH_PPJ        # commonds to run in parallel per job
$ export QBATCH_MEM="0"                  # requested memory per job
$ export QBATCH_MEMVARS="mem"            # memory request variable to set
$ export QBATCH_SYSTEM="pbs"             # queuing system to use
$ export QBATCH_NODES=1                  # (PBS-only) nodes to request per job
$ export QBATCH_PE="smp"                 # (SGE-only) parallel environment name

These correspond to the same named options in the qbatch help output above.

Some examples:

# Submit an array job from a list of commands (one per line)
# Generates a job script in ./.scripts/ and job logs appear in ./logs/
$ qbatch commands.txt

# Set the walltime for each job
$ qbatch -w 3:00:00 commands.txt

# Run 24 commands per job
$ qbatch -c24 commands.txt

# Request 1# Run 24 commands per job, but run 12 in parallel at a time
$ qbatch -c24 -j12 commands.txt

# Start jobs after successful completion of existing jobs with names starting with "stage1_"
$ qbatch --afterok 'stage1_*' commands.txt

# Pipe a list of commands to qbatch
$ parallel echo process.sh {} ::: *.dat | qbatch -

# Run jobs locally with GNU Parallel, 12 commands in parallel
$ qbatch -b local -j12 commands.txt

# Many options don't make sense locally: chunking, individual vs array, nodes,
# ppj, highmem, and afterok are ignored

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

qbatch-1.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

qbatch-1.0-py2.py3-none-any.whl (9.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file qbatch-1.0.tar.gz.

File metadata

  • Download URL: qbatch-1.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for qbatch-1.0.tar.gz
Algorithm Hash digest
SHA256 00824ee3424140bc32096e9c875239e7ccc2c8ba24b1e3369c29de805023f916
MD5 b310ca24e546520b6b55f21fb5ee25c8
BLAKE2b-256 528eb93bf9d038ecf89a76b101304019ef01559445365f6ec668569b41e14024

See more details on using hashes here.

File details

Details for the file qbatch-1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for qbatch-1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e2659de226a0a009d52bd121177c6c8244633ede669ee4048bfd1f1c8debb2b4
MD5 4b3ee03de55f31cf3a7e669cff6a027f
BLAKE2b-256 cdf06b68c5c8d32653a2317ef6bbeb5a30a616225db32bd3cea9261ffd0d5665

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page