parallel
[Top][All Lists]
Advanced

[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: Wed, 26 Jun 2019 19:06:52 +0200

On Tue, Jun 25, 2019 at 11:50 PM Cook, Malcolm <MEC@stowers.org> wrote:

> Hmm,
>
> parallel -j0 -sh bash -c "parallel  do_something '{}'" ::: 'job1 job2 job3'  
> 'job4 job5'  'job6 job7'

I see what you are saying. We can probably make a wrapper as a crappy
workaround. But --joblog, {#} and a lot of other details will be
wrong.

So here is a 10 minutes crappy wrapper:

#!/bin/bash

parpar() {
    . `which env_parallel.bash`
    env_parallel --session

    inner() {
        parallel "${command[@]}"
    }
    export -f inner

    command=()
    while [[ $# -gt 0 ]]; do
        if [[ $1 == ",,," ]] ; then
            break
        fi
        command+=("$1")
        shift
    done
    printf "%s\n" "$@" |
        env_parallel --pipe --recend ',,,\n' --rrs -j1 -N1 inner
}

# Example (,,, = wait for completion)
parpar -v sleep {}\; echo {} ,,, 3.9 4 4.1 ,,, 1 2 3 ,,, 0.2 0.3 0.1


/Ole



reply via email to

[Prev in Thread] Current Thread [Next in Thread]