All Projects → fd0 → Machma

fd0 / Machma

Licence: bsd-2-clause
Easy parallel execution of commands with live feedback

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Machma

Alive Progress
A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
Stars: ✭ 2,940 (+571.23%)
Mutual labels:  cli, feedback
Redrun
✨🐌 🐎✨ fastest npm scripts runner
Stars: ✭ 85 (-80.59%)
Mutual labels:  cli, parallel
Npm Run All
A CLI tool to run multiple npm-scripts in parallel or sequential.
Stars: ✭ 4,496 (+926.48%)
Mutual labels:  cli, parallel
Tqdm
A Fast, Extensible Progress Bar for Python and CLI
Stars: ✭ 20,632 (+4610.5%)
Mutual labels:  cli, parallel
Dstask
Single binary terminal-based TODO manager with git-based sync + markdown notes per task
Stars: ✭ 431 (-1.6%)
Mutual labels:  cli
Plop
Consistency Made Simple
Stars: ✭ 4,765 (+987.9%)
Mutual labels:  cli
Jtc
JSON processing utility
Stars: ✭ 425 (-2.97%)
Mutual labels:  cli
Remarshal
Convert between CBOR, JSON, MessagePack, TOML, and YAML
Stars: ✭ 421 (-3.88%)
Mutual labels:  cli
X Build
🖖 Customizable front-end engineering scaffolding tools
Stars: ✭ 436 (-0.46%)
Mutual labels:  cli
Gosh
Gosh - a pluggable framework for building command shell programs
Stars: ✭ 434 (-0.91%)
Mutual labels:  cli
Phpmnd
PHP Magic Number Detector
Stars: ✭ 431 (-1.6%)
Mutual labels:  cli
Win Acme
A simple ACME client for Windows (for use with Let's Encrypt et al.)
Stars: ✭ 4,305 (+882.88%)
Mutual labels:  cli
Rivalcfg
CLI tool and Python library to configure SteelSeries gaming mice
Stars: ✭ 430 (-1.83%)
Mutual labels:  cli
Promptui
Interactive prompt for command-line applications
Stars: ✭ 4,621 (+955.02%)
Mutual labels:  cli
Enry
A faster file programming language detector
Stars: ✭ 435 (-0.68%)
Mutual labels:  cli
Ola
The Open Lighting Architecture - The Travel Adaptor for the Lighting Industry
Stars: ✭ 424 (-3.2%)
Mutual labels:  cli
Create React Library
⚡CLI for creating reusable react libraries.
Stars: ✭ 4,554 (+939.73%)
Mutual labels:  cli
Aws Google Auth
Provides AWS STS credentials based on Google Apps SAML SSO auth (what a jumble!)
Stars: ✭ 428 (-2.28%)
Mutual labels:  cli
Haptico
Haptico 📳 - easy to use haptic feedback generator with pattern-play support
Stars: ✭ 426 (-2.74%)
Mutual labels:  feedback
Splash Cli
A simple, command line tool to download Unsplash wallpapers. It’s not intended to be anything particularly fancy — it just works.
Stars: ✭ 432 (-1.37%)
Mutual labels:  cli

Status badge for tests

machma - Easy parallel execution of commands with live feedback

Introduction

In order to fully utilize modern machines, jobs need to be run in parallel. For example, resizing images sequentially takes a lot of time, whereas working on multiple images in parallel makes much better use of a multi-core CPU and therefore is much faster. This tool makes it very easy to execute tasks in parallel and provides live feedback. In case of errors or lines printed by the program, the messages are tagged with the job name.

machma by default reads newline-separated values and replaces all command-line arguments set to {} with the file name. The number of jobs is set to the number of cores for the CPU of the host machma is running on.

Sample Usage

Resize all images found in the current directory and sub-directories to 1200x1200 pixel at most:

$ find . -iname '*.jpg' | machma --  mogrify -resize 1200x1200 -filter Lanczos {}

The command specified after the double dash (--) is executed with each parameter that is set to {} replaced with the file name. At the bottom, a few status lines are printed after a summary line. The lines below visualize the status of the instances of the program running in parallel. The line for an instance will either contain the name of the file (in this case) that is being processed followed by the newest message printed by the program.

demo: resizing files

Ping a large number of hosts, but only run two jobs in parallel:

$ cat /tmp/ips | machma -p 2 -- ping -c 2 -q {}

The program ping will exit with an error code when the host is not reachable, and machma prints an error message for all jobs which returned an error code.

demo: ping hosts

A slightly more sophisticated (concerning shell magic) example is the following, which does the same but recduces the output printed by ping a lot:

$ cat /tmp/ips | machma -- sh -c 'ping -c 2 -q $0 > /dev/null && echo alive' {}

demo: ping hosts again

Using --timeout you can limit the time mogrify is allowed to run per picture. (Prevent jobs from 'locking up') The value for timeout is formatted in golang time.Duration format. When the timeout is reached the program gets canceled.

$ find . -iname '*.jpg' | machma --timeout 5s --  mogrify -resize 1200x1200 -filter Lanczos {}

Files With Spaces

Sometimes filenames have spaces, which may be problematic with shell commands. Most of the time, this should not be a problem at all, since machma runs programs directly (using the execve syscall on Linux for example) instead of using system(). For all other cases there's the --null (short: -0) option which instructs machma to read items separated by null bytes from stdin. This can be used with the option -print0 of the find command like this:

$ find . -iname '*.jpg' -print0 | machma --null --  mogrify -resize 1200x1200 -filter Lanczos {}

Installation

Installation is very easy, install a recent version of Go and run:

$ go run build.go

Afterwards you can view the online help:

$ ./machma --help
Usage of ./machma:
      --no-id              hide the job id in the log
      --no-name            hide the job name in the log
      --no-timestamp       hide the time stamp in the log
  -0, --null               use null bytes as input separator
  -p, --procs int          number of parallel programs (default 2)
      --replace string     replace this string in the command to run (default "{}")
      --timeout duration   set maximum runtime per queued job (0s == no limit)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].