Command-line utility to execute commands in parallel and aggregate their output.
Similar interface to GNU Parallel or xargs but implemented in rust and tokio.
* Supports running commands read from stdin or input files similar to xargs.
* Supports :::
syntax to run all combinations of argument groups similar to GNU Parallel.
* Optional transformation of inputs using regular expression capture groups.
See examples for example commands and manual for more details.
Prevents output interleaving and is very fast.
Listed in Awesome Rust - utilities
Recommended:
For manual installation/update:
1. Install Rust
2. Install the latest version of this app from crates.io:
$ cargo install rust-parallel
3. The same cargo install rust-parallel
command will also update to the latest version after initial installation.
#![forbid(unsafe_code)]
)expand
function to replace specified capture groups with input data.which
library used to build the path cache only has a blocking interface, so tokio::task::spawn_blocking
is used to invoke this.O(number of input lines)
memory usage. In support of this:
tokio::sync::Semaphore
is used carefully to limit the number of commands that run concurrently. Do not spawn tasks for all input lines immediately to limit memory usage.--disable-path-cache
option.multi_cartesian_product
to process :::
command line inputs.-r
/--regex
option.async
/ await
functions (aka coroutines)CommandLineArgs
instance using tokio::sync::OnceCell
.tokio::process::Command
tokio::sync::Semaphore
used to limit number of commands that run concurrently.tokio::sync::mpsc::channel
used to receive inputs from input task, and to send command outputs to an output writer task. To await command completions, use the elegant property that when all Senders
are dropped the channel is closed.tracing::Instrument
is used to provide structured debug logs.