Live data from Hacker News

GNU Parallel

gnu.org

21–30 of 76 posts

Re: GNU Parallel

#21
post #20

If you want to execute commands on multiple remote hosts over SSH, just run a tmux session and launch a tab on each host in a loop and execute them. It's far easier to follow the output and individually deal with prompts.

I do the same, I even have a command that tells me which tmux panel I'm in so I can ssh to many servers at once from tmux.

However, when you just want to execute the same command : https://clustershell.readthedocs.io/en/latest/tools/clush.ht...

Re: GNU Parallel

#22
post #12

Earlier quoted context omitted.

The comparison is not very fair to modern day xargs. `nproc` is a relatively standard utility (coreutils). So, xargs -P$(nproc) gets you core (or core-proportional) parallelism. Grouping output/Making a safe parallel grep is also easy-ish with `--process-slot-var=slot` and sending to `tmpOut.$slot`. Jobs on remote computers can be done similarly with any kind of `arrayVar[$slot]` setup where `arrayVar` has a bunch of…

> Anyway, those three are just off the top of my head, unfairness-wise. Last I looked at the source for GNU parallel it looked like mountains upon mountains of Perl I would rather not depend upon, personally, but to each his own. Well, there was a Rust version with zero Perl, now unfortunately archived. It wasn't 100% on a par with the original and wasn't really finished. On the other hand, built easily for Windows a…

Well, some archived project is not so great either. The core functionality is not even a 20 line bash script since bash grew wait -n, though:

    #!/bin/bash
    if [ "${1-0}" -lt 1 ]; then             # No arg / arg not a number >= 1
      echo "Usage: $0 "; echo "reads cmds from stdin, running up to N at once."
      exit 1
    fi
    TMP=`mktemp -t stripen.XXXXXX`
    trap 'rm -f $TMP; exit 0' HUP INT TERM EXIT
    STRIPE_SEQ=1
    while read cmd; do
        jobs > $TMP                         # jobs | wc -l does not work
        if [ $(wc -l 
and if bash ever grows some magic environment variable $NUM_BG_JOBS or you don't want auto-help or sequence numbers or etc. it can be even simpler.

Re: GNU Parallel

#23
post #5

Earlier quoted context omitted.

I don't understand how GNU finds this acceptable...

[edited for formatting and to fix Git link] According to https://git.savannah.gnu.org/cgit/parallel.git/tree/doc/cita... > == Is the citation notice compatible with GPLv3? == > Yes. The wording has been cleared by Richard M. Stallman to be compatible with GPLv3. This is because the citation notice is not part of the license, but part of academic tradition. > Therefore the notice is not adding a term that would requir…

This is an excellent explanation of why "GNU finds this acceptable".

Note that the citation message can also be easily silenced just by creating an empty file:

    touch ~/.parallel/will-cite

Re: GNU Parallel

#24
post #20

If you want to execute commands on multiple remote hosts over SSH, just run a tmux session and launch a tab on each host in a loop and execute them. It's far easier to follow the output and individually deal with prompts.

True, but for a large number of hosts, going manually through prompts doesn't scale anymore. Sometimes you just want to check whether all hosts have the same configuration file, or something like that. That's where GNU Parallel can save your gluteus maximus:

    cat hosts.txt | parallel --quote --timeout=10 ssh {} 'echo {} $(md5sum ~/.config/file)'
The above command would take a list of hostnames from the hosts.txt file, connect to each one, hash the config file and print out hostnames and hashes in one line per host.

Re: GNU Parallel

#25
There's probably a more unix-centric / idiomatic way to do it, but using GNU Parallel along with Redis made automating tasks to process tens of thousands of systems extremely easy, repeatable, pausable, restartable, etc. And the fact you can do atomic operations on queues prevented any potential worker collisions.

Re: GNU Parallel

#26
post #12

This can be a good entry into the "why" for many people that use xargs now - https://www.gnu.org/software/parallel/parallel_alternatives.... It has a lot of features that can feel excessive at first glance but if you have felt some pain in building jobs, most of it is pretty sensible and much better than rollyourown.

The comparison is not very fair to modern day xargs. `nproc` is a relatively standard utility (coreutils). So, xargs -P$(nproc) gets you core (or core-proportional) parallelism. Grouping output/Making a safe parallel grep is also easy-ish with `--process-slot-var=slot` and sending to `tmpOut.$slot`. Jobs on remote computers can be done similarly with any kind of `arrayVar[$slot]` setup where `arrayVar` has a bunch of…

Perl has retained stable backwards compatibility and no breaking changes for 20+ years. What's wrong with Perl?

Re: GNU Parallel

#27
post #20

If you want to execute commands on multiple remote hosts over SSH, just run a tmux session and launch a tab on each host in a loop and execute them. It's far easier to follow the output and individually deal with prompts.

I love tmux for this application, and typically I tend to prefer alternate solutions to using parallel.. but to be fair there are many more usecases for parallel than the one you describe here.

Re: GNU Parallel

#28
post #5
post #2

It's nice, but the citation bit strikes me as very non-free: > If you use --will-cite in scripts to be run by others you are making it harder for others to see the citation notice. The development of GNU parallel is indirectly financed through citations, so if your users do not know they should cite then you are making it harder to finance development. However, if you pay 10000 EUR, you have done your part to finance…

I don't understand how GNU finds this acceptable...

I don't care what GNU thinks, but it's simply not scalable.

Imagine a world where every utility has its own irritating nag message that needs to be turned off.

Re: GNU Parallel

#29

Earlier quoted context omitted.

[edited for formatting and to fix Git link] According to https://git.savannah.gnu.org/cgit/parallel.git/tree/doc/cita... > == Is the citation notice compatible with GPLv3? == > Yes. The wording has been cleared by Richard M. Stallman to be compatible with GPLv3. This is because the citation notice is not part of the license, but part of academic tradition. > Therefore the notice is not adding a term that would requir…

This is an excellent explanation of why "GNU finds this acceptable". Note that the citation message can also be easily silenced just by creating an empty file: touch ~/.parallel/will-cite

[deleted]

Re: GNU Parallel

#30
post #5

Earlier quoted context omitted.

I don't understand how GNU finds this acceptable...

I don't care what GNU thinks, but it's simply not scalable. Imagine a world where every utility has its own irritating nag message that needs to be turned off.

Don't need to imagine, I lived in that world where most utilities I used were shareware with a nag screen on startup...
Post reply on HN