forkrun
pueue
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
forkrun
- Forkrun: Runs multiple inputs through a command in parallel using bash coprocs
- Forkrun – A pure-bash function for parallelizing loops
-
rparse: an easy-to-use shell script/function option parser that uses regex to determine which inputs are options
EDIT: moved code + example to GITHUB
-
[BASH] Can I use procfs to change the file that a backgrounded process is writing data to?
One example that I dont know how to do streaming for involves breaking up the stdin stream and sending it to different places, but where you determine where to send it in realtime. This isnt the code that spawned this particular thread, but a good example of this is in this function I wrote called forkrun.
-
Optimizing bash scripts?
If you want an example of a really optimized bash script check out my forkrun utility. I spent a really long time optimizing it. It parallelizes loops (like xargs -P and parallel), and for problems with "many very quick iterations" (e.g., sha256sum of a million tiny files) it is twice as fast as the fastest method available via xargs or parallel (which means it is outpacing well optimized compiled C/C++ binaries).
-
Bash continuous parallelization
as it so happens, I recently wrote a script called forkrun that parallelizes loops really fast. In particular for things like your simulation that require running 1 at a time in parallel (N parallel batches of 1 simulation, as opposed to N parallel batches of M simulations) the parallelization framework itself is 7x faster than xargs -l 1 -P N and ~25x faster than parallel -j N.
-
Globals or not globals?
However, if you have bash 4 or later, using bash coprocs can offer much better performance. The idea is that you spawn a bunch of persistent coprocs and pipe data to them, allowing you to parallelize the loop without forking each individual iteration. I wrote / am writing a utility called forkrun that parallelizes loops using bash coprocs. You're welcome to use it, though heads up it is still in beta (almost everything works, but I am still debugging the -k flag sometimes not working properly...-k ensures the output order is the same as input order). If nothing else it gives a real world example of parallelizing using coprocs.
-
Can you force bash to not give a throw a specific error?
Side note: in case you were wondering the actual code that inspired this post is my forkrun utility. If you felt like checking it out Id love to hear any feedback you might have on it.
-
Out of curiosity, what is your best script you can showcase?
For me? My personal best script is (by a wide margin) my forkrun utility. It uses bash coprocs to efficiently parallelize loops. Usage is nearly identical to xargs -P <#>. Options are similar to xargs....a few are missing (namely those related to running things interactively), and a few options are things xargs doesnt do but forkrun can.
-
How can I run commands in parallel and write the output of each command to different linux terminals, one linux terminal for each command running in parallel.
I wrote a nifty function for parallelizing loops in bash really fast called forkrun. It will, with the help of tail -F, let you do this (among many other things) by writing the output from each parallel worker to a separate file, which you can then monitor in real time with tail -F in another terminal window.
pueue
-
Sequential and parallel execution of long-running shell commands
You can probably do a good subset it in bash, it's just a nicer interface with a lot of configurability and several convenience features.
I'm generally a big fan of showing alternatives: https://github.com/Nukesor/pueue/?tab=readme-ov-file#similar...
Would you be willing to write a proper guide on how to do all of these things in bash? It would be great to have this as guide an alternative inside the Pueue wiki and link to it. It'll help people to make a more informed decision on whether they need this tool or not.
-
Looking for a pueue debian maintainer
there is a command line manager for long running tasks called Pueue. It is released into Nix, Arch, Alpine, Void, etc, but not for Debian based distros. I know that releasing into Debian is a bit more challenging, but I just wanted to ask if anybody here might be interested in packaging it. Just as a disclaimer, I am not the author of this project, just a regular user.
-
Can't find the name of a tool...
This one? https://github.com/Nukesor/pueue
-
Systemd timer having service running one after the other at a set time.
How about this: https://github.com/Nukesor/pueue/? I have it bookmarked from a thread here from few years back and never got to test it eventually, but maybe it will serve your purposes?
-
How can I run commands in parallel and write the output of each command to different linux terminals, one linux terminal for each command running in parallel.
Multiplexing is great for your multiple outputs, but I would highly recommend using pueue & pueued for job control. Lets you organize your background jobs into groups which can be paused, resumed, etc. Also lets you act on jobs from different terminals w/the pueue interface.
-
What "nice-to-have" CLI tools do you know?
pueue -- a queue for tasks, running in background
-
Why is Tmux better than neovim's built-in terminal?
For the command that takes a long time to complete, I always use pueue to run. This thing let you run multiple commands in order and can schedule the execution later which is really helpful to my workflow.
-
Should I use async or multiprocessing in my project and which library to use?
That said, you're basically building pueue. https://github.com/Nukesor/pueue/blob/main/ARCHITECTURE.md might give you some pointers. From reading it, there seems to be a mishmash of tokio stuff, and then everything gets serialised onto an MPSC channel (that's serviced by TaskHandler, on a single thread that's also responsible for polling for finished processes etc, every 200ms).
-
What do you use to copy large files from one HDD to another?
exchange for pueue and you can even queue them up.
-
What are some popular background job processing frameworks in the Rust ecosystem?
This is the only one I know of: https://github.com/Nukesor/pueue
What are some alternatives?
pkm - A super minimal TUI package manager wrapper written in BASH v4.2+
tantivy - Tantivy is a full-text search engine library inspired by Apache Lucene and written in Rust [Moved to: https://github.com/quickwit-oss/tantivy]
bin - my bins (mostly shell scripts)
tab-rs - The intuitive, config-driven terminal multiplexer designed for software & systems engineers
resholve - a shell resolver? :) (find and resolve shell script dependencies)
awesome-rewrite-it-in-rust - A curated list of replacements for existing software written in Rust [Moved to: https://github.com/TaKO8Ki/awesome-alternatives-in-rust]
dyetide - a bash script that replaces hex, rgb, or hsl color codes out for other color codes. either within a file or from the terminal!
breeze - An experimental, kakoune-inspired CLI-centric text/code editor with |-shaped cursor (in Rust)
dun - Meeting notes and todo tasks CLI
nq - Unix command line queue utility
fml - :card_index_dividers: A stupid simple, fast TUI file manager written in BASH v4.2+
starfetch - Display constellations in your terminal