From: Bart Schaefer <schaefer@brasslantern.com>
To: Perry Smith <pedz@easesoftware.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Parallel processing
Date: Fri, 25 Mar 2022 11:27:12 -0700 [thread overview]
Message-ID: <CAH+w=7baN47QxGiga9WVTHHny7JnjbbCudfkDKR+qEq1pAgcnw@mail.gmail.com> (raw)
In-Reply-To: <1E0E1226-E3E8-40AD-87CD-93A602B1B08B@easesoftware.com>
On Thu, Mar 24, 2022 at 9:34 PM Perry Smith <pedz@easesoftware.com> wrote:
>
> Has something like prll (parallel) https://github.com/exzombie/prll been added to zsh?
Look at the "zargs" function, -P option (which works like "xargs -P"
for the most part).
Silly example:
autoload zargs
zmodload zsh/system
zargs -n 2 -P 4 -- {1..20} -- eval '() { print $1 $sysparams[pid]; sleep 2 }'
Note you need -n 2 there because the first "word" is the argument to
eval and the second "word" is the successive integer from the list 1
through 20.
This isn't exactly what you want because it waits for all four jobs
before starting the next batch, but keeping a specific number of
children running is not straightforward with the job-management
operations available to a shell.
next prev parent reply other threads:[~2022-03-25 18:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-25 4:34 Perry Smith
2022-03-25 18:27 ` Bart Schaefer [this message]
2022-03-26 18:10 ` Philippe Troin
2022-03-26 22:19 ` Bart Schaefer
2022-03-27 17:32 ` Philippe Troin
2022-03-27 17:42 ` Bart Schaefer
2022-03-27 19:23 ` Dominik Vogt
2022-03-28 13:26 ` Perry Smith
2022-03-28 13:31 ` Perry Smith
2022-03-26 4:34 jdh
2022-03-27 18:37 jdh
2022-03-27 19:06 ` Bart Schaefer
2022-03-27 19:24 ` Ray Andrews
2022-03-28 13:47 ` Perry Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH+w=7baN47QxGiga9WVTHHny7JnjbbCudfkDKR+qEq1pAgcnw@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=pedz@easesoftware.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).