bug-parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU Parallel Bug Reports Job slot number {%}


From: Jamshid Afshar
Subject: GNU Parallel Bug Reports Job slot number {%}
Date: Mon, 22 Sep 2014 23:01:25 -0500

Hi, I'm trying to use the job slot number "{%}" in order to run a
command on a pool of servers.

$ sem --version
GNU parallel 20140822

I'm just trying to execute a collection of unit tests, one at a time
per server, on a pool of servers.

Running all the below commands at the same time seems to work as
expected -- only three jobs run at a time, but "{%}" is always "1".

I'd expect it to cycle 1-3.

If there's a way of accomplish this with some simple scripting, please
let me know, I'm not getting it. Thanks.

Here's Ole's response on the discussion list:

On Thu, Sep 11, 2014 at 5:08 AM, Ole Tange <address@hidden> wrote:
> I understand why you might expect that. But {%} is not stored between
> invocations. So if we want {%} to work with 'sem' then we need somehow
> to store that when starting the job and remove it when done.
> It is working when not using 'sem'/--semaphore.

REPRO:

sem --fg --jobs 3 --id my_id -u 'echo First started: $PARALLEL_SEQ,
pretend to run on server {%} ; sleep 5; echo The first finished' &
sem --fg --jobs 3 --id my_id -u 'echo Second started $PARALLEL_SEQ,
pretend to run on server {%} ;  sleep 6; echo The second finished' &
sem --fg --jobs 3 --id my_id -u 'echo Third started $PARALLEL_SEQ,
pretend to run on server {%} ;  sleep 7; echo The third finished' &
sem --fg --jobs 3 --id my_id -u 'echo Fourth started $PARALLEL_SEQ,
pretend to run on server {%} ; sleep 8; echo The fourth finished' &
sem --fg --jobs 3 --id my_id -u 'echo Fifth started $PARALLEL_SEQ,
pretend to run on server {%} ; sleep 9; echo The fifth finished' &
sem --fg --wait --id my_id

===================

Third started 1, pretend to run on server 1
Fourth started 1, pretend to run on server 1
Fifth started 1, pretend to run on server 1
The third finished
Second started 1, pretend to run on server 1
The fourth finished
First started: 1, pretend to run on server 1
The fifth finished
The first finished
The second finished



reply via email to

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