Performs distributed command execution, written in Rust w/ Tokio

Related tags

System tools concurr
Overview

Concurr: Distributed and Concurrent Command Execution, in Rust

This project is dual licensed under MIT and Apache 2.0.

Originally inspired by the GNU Parallel project, and my previous re-implementation of the project in Rust, Concurr is a distributed and concurrent command-line job server & client architecture for generating and executing commands in parallel on any number of systems. At it's core, Concurr uses Tokio to perform asynchronous network I/O. The client works similarly to GNU Parallel, but there are key differences for the sake of simplicity in operation.

The Client

The client is responsible for parsing arguments, connecting to nodes and obtaining slot counts, submitting a command to each node, distributing inputs to each slot on each connected node, collecting responses from those slots when they complete, and requesting new inputs from a shared buffer. Simple stuff. Syntax is to be very similar to GNU Parallel, but there are some differences.

Example

concurr 'echo job {#} on slot {%}: {}' : arg1 arg2 arg3 arg4
concurr 'echo job {#} on slot {%}: {}' :: file1 file2 file3
concurr 'echo {}' < input_file
cat file | concurr 'echo {}'

How The Client Works

The Server

How The Server Works

The service works by listening for a number of possible instructions that can be supplied. A command instruction will tell the server to create a new command with a pool of threads that will listen for inputs, henceforth named as slots. A delete instruction can be used to delete commands from the server, thus causing all threads to exit after completing their tasks. Input instructions will supply inputs to commands, which are designated by an integer ID, and also specify the ID of the job, which may be useful to the client knowing which input received what results.

Effectively, a client can send a command to a server, which will spawn as many threads as there are cores in the system; initializing an instance of the Ion shell on each slot. These slots have shared access to an input buffer, output buffer, kill switch, and corresponding counter to count the number of threads that have exited. These are all wrapped up together in a unit.

When an input is received from a client, that input is matched to a unit and then placed onto an input buffer that is collectively owned by the threads that are attached to that command. When a slot grabs that input, it will perform a fork, capture the standard output and error of the fork, execute the command within an embedded Ion instance attached to that slot on the child, and then wait for the child to exit before placing the exit status, job ID, and file descriptors containing the standard output and error onto an output buffer.

The connection that submitted the input will have been waiting for a result that matches the ID of the job that was submitted, and upon seeing that job, will immediately encode a response with the results.

Example

  1. The following command, assigned ID 0, is sent to the server: echo {#}: {}
  2. The server has four cores, and creates four slots for that command.
  3. Some inputs are submitted to the command with ID 0:
  • inp 0 1 one
  • inp 0 2 two
  • inp 0 3 three
  • inp 0 4 four
  1. Slots concurrently grab inputs from the queue, process them, and return their outputs:
  • 1: one
  • 2: two
  • 3: three
  • 4: four
  1. The exit status, job ID, standard out, and standard error are returned to the client.
You might also like...
A non-root version of traceroute written in Rust

tracepath-rs A non-root version of traceroute written in Rust for Linux.

Dancing Links (“dlx”) solver for the exact cover problem, written in Rust. Can be used to create a sudoku solver.

Dancing Links “dlx” Dancing Links solver for “algorithm X” by Knuth This solver solves the exact cover problem using “algorithm X”, implemented using

A system handler to get information and interact with processes written in Rust

A system handler to get information and interact with processes written in Rust

LeftHK - A hotkey daemon written in Rust

LeftHK LeftHK - A hotkey daemon written in Rust THIS IS BETA SOFTWARE The configuration file should be created in ~/.config/lefthk/ and called config.

Yet another fancy watcher. (Rust)

funzzy Yet another fancy watcher. (Inspired by antr / entr) Configure execution of different commands using semantic yaml. # .watch.yaml # list here a

A more intuitive version of du in rust
A more intuitive version of du in rust

Dust du + rust = dust. Like du but more intuitive. Why Because I want an easy way to see where my disk is being used. Demo Install Cargo cargo install

Fuzzy Finder in rust!
Fuzzy Finder in rust!

Life is short, skim! Half of our life is spent on navigation: files, lines, commands… You need skim! It is a general fuzzy finder that saves you time.

A library to listen to global hotkeys in Rust

Rust Hotkey A library to listen to global hotkeys in Rust How to use See the examples folder for how to use this library. OS Support This lib aims to

🔮 Futuristic take on hexdump, made in Rust.
🔮 Futuristic take on hexdump, made in Rust.

hex (hx) Futuristic take on hexdump. hx accepts a file path as input and outputs a hexadecimal colorized view to stdout. $ hx tests/files/alphanumeric

Comments
  • Build fails with both nightly and stable with

    Build fails with both nightly and stable with "cannot infer type for `T`"

    Don't know if this repo is dead or not, but I ran into an issue while building this that was easily fixed.

    While building app_dirs = "1.1", specifically building rand v0.3.16, I get "cannot infer type for T ". This seems to be an issue with that specific version rand since when I updated app_dirs to 1.2.1, everything works. It was pretty simple to fix, so I'll just make a pull request which you can merge or reject at your leisure.

    opened by sguzman 3
  • updated app_dirs

    updated app_dirs

    Don't know if this repo is dead or not, but I ran into an issue while building this that was easily fixed.

    While building app_dirs = "1.1", specifically building rand v0.3.16, I get "cannot infer type for T ". This seems to be an issue with that specific version rand since when I updated app_dirs to 1.2.1, everything works. It was pretty simple to fix, so I'll just make a pull request which you can merge or reject at your leisure.

    opened by sguzman 1
Owner
Michael Murphy
System76 engineer; Linux developer; Rust programmer
Michael Murphy
minimalistic command launcher in rust

rrun Note: Apart from the occasional fix, this project is not actively developed anymore. rrun works fine and should run/compile for the time being on

null 105 Nov 18, 2022
Small command-line JSON Log viewer

fblog A small tool to view json log files. Filter To filter log messages it is possible to use lua fblog -f 'level ~= "info"' # will print all message

null 256 Jan 2, 2023
The next gen ls command

LSD (LSDeluxe) Table of Contents Description Screenshot Installation Configuration External Configurations Required Optional F.A.Q. Contributors Credi

Pierre Peltier 9k Jan 2, 2023
Super-fast command aliases with arguments.

Bonnie Bonnie is a command aliasing tool. If you have a super-long command that you have to run all the time, Bonnie is for you! Just define the comma

arctic_hen7 58 Dec 22, 2022
A modern alternative to watch command

A modern alternative to watch command

Tavo Annus 7 Oct 7, 2022
A modern replacement for ps written in Rust

procs procs is a replacement for ps written in Rust. Documentation quick links Features Platform Installation Usage Configuration Features Output by t

null 3.6k Jan 5, 2023
Blazing 💥 fast terminal-ui for git written in rust 🦀

Blazing fast terminal client for git written in Rust Features Fast and intuitive keyboard only control Context based help (no need to memorize tons of

Stephan Dilly 11.8k Jan 5, 2023
A simple and fast download accelerator, written in Rust

zou A simple and fast download accelerator, written in Rust Zou is a Snatch fork by @k0pernicus. Snatch is a fast and interruptable download accelerat

Antonin Carette 173 Dec 4, 2022
A bash-like Unix shell written in Rust

Cicada Unix Shell Cicada is a simple Unix shell written in Rust. Documents Install cicada Environment Variables Cicada Builtins Completion RC File His

Hugo Wang 921 Dec 28, 2022
A TUI system monitor written in Rust

NO LONGER MAINTAINED. For a similar program, check out https://github.com/ClementTsang/bottom. ytop Another TUI based system monitor, this time in Rus

Caleb Bassi 2.1k Jan 3, 2023