[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature Request: Special input value to create a barrier
From: |
Ole Tange |
Subject: |
Re: Feature Request: Special input value to create a barrier |
Date: |
Sun, 23 Jun 2019 15:27:15 +0200 |
On Sun, Jun 23, 2019 at 1:33 PM Achim Gratz <Stromeko@nexgo.de> wrote:
> I could use a (configurable) special input value that creates a barrier
> (i.e. wait for all previous jobs to finish) upon parallel encountering
> it. Usage would be something like:
>
> parallel --barrier + do_something '{}' ::: job1 job2 job3 + job4 job5 + job6
> job7
>
> which should start the first three jobs, wait for them to finish, then
> starts the fourth and fifth job, waits again for these to finish, then
> the remaining sixth and seventh job are started in parallel.
I can see how this would make sense from a user perspective, so I am
not opposed to the idea.
You _could_ just do:
parallel --barrier + do_something '{}' ::: job1 job2 job3
parallel --barrier + do_something '{}' ::: job4 job5
parallel --barrier + do_something '{}' ::: job6 job7
but I can see how the syntactic sugar could make some tasks easier.
What should this do:
parallel --barrier + dostuff ::: 1 2 3 + 4 5 + 6 7 ::: a + b c + d e
f + g + h :::+ A B C D E + F G H
We already have -E to make GNU Parallel stop reading when hitting a
special value. This gets us partly there.
I think, however, it will be quite tricky make GNU Parallel resume
after it finished all running jobs. Nothing in the design is made for
resuming. I am not saying it cannot be done, but I will be surprised
if it is an easy change.
So patch welcome (but I have a feeling it will be a rather big change).
/Ole