You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by fnord <li...@libertylost.org> on 2009/04/29 22:59:06 UTC

Weird parallel/for situation

I've got a situation that I'm trying to script around, and I'm somewhat
stumped, and hoping someone might have a solution.

I have an array of servers, prod1, prod2, prod3, and prod4.

I'm using a foreach to call restarts of them. Using the parallel parameter,
this is blazing fast, which is great.

The problem is that I need to pause after the first restart to make sure
that the application came up properly, then pause for 30 seconds after each
of the rest.

What I'd like to do is put an "<input>Hit enter when you would like to
continue</input>" after each of the restarts, but these just end up as part
of the parallel tasks, which all run at the same time, then it waits for me
to hit enter 4 times before completing.

Any thoughts on how to implement this? The first pause could be a long time,
and each of the later ones will be around 30 seconds, as we wait for the
load balancer to notice that http is not responding on the host.  So having
an <input> task would be ideal, but I just can't sort a way to get it to
work.


thanks,
fnord
-- 
View this message in context: http://www.nabble.com/Weird-parallel-for-situation-tp23302387p23302387.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Weird parallel/for situation

Posted by sridhar bitkuri <bi...@gmail.com>.
You might try using sleep stmts after each task put the time appropriately,
say 60 sec. may be...

On Wed, Apr 29, 2009 at 4:59 PM, fnord <li...@libertylost.org> wrote:

>
> I've got a situation that I'm trying to script around, and I'm somewhat
> stumped, and hoping someone might have a solution.
>
> I have an array of servers, prod1, prod2, prod3, and prod4.
>
> I'm using a foreach to call restarts of them. Using the parallel parameter,
> this is blazing fast, which is great.
>
> The problem is that I need to pause after the first restart to make sure
> that the application came up properly, then pause for 30 seconds after each
> of the rest.
>
> What I'd like to do is put an "<input>Hit enter when you would like to
> continue</input>" after each of the restarts, but these just end up as part
> of the parallel tasks, which all run at the same time, then it waits for me
> to hit enter 4 times before completing.
>
> Any thoughts on how to implement this? The first pause could be a long
> time,
> and each of the later ones will be around 30 seconds, as we wait for the
> load balancer to notice that http is not responding on the host.  So having
> an <input> task would be ideal, but I just can't sort a way to get it to
> work.
>
>
> thanks,
> fnord
> --
> View this message in context:
> http://www.nabble.com/Weird-parallel-for-situation-tp23302387p23302387.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Weird parallel/for situation

Posted by David Weintraub <qa...@gmail.com>.
Could you use the <waitfor> task? This is  meant specifically to be
used with the <parallel> task. You can specify what to wait for before
continuing. For example, when the server starts up, it could create a
file that the <waitfor> task looks for before continuing.

You can use the waitfor to wait for the server URL to return a valid
return code. I've done that before. Something like this after you
start up all of your servers via the <foreach> task:

<foreach ..../>

<waitfor maxwait="1" maxwaitunit="minute">
    <equals arg1="1" arg2="2"/>
</waitfor>

<for...>
     <waitfor maxwait="30" maxwaitunit="minute">
         <http url="${SERVER_URL}"/>
    </waitfor>
</for>

<waitfor maxwait="30" maxwaitunit="second">
    <equal arg1="1" arg2="2"/>
</waitfor>

The first <waitfor> simply waits for a minute before continuing. You
need to specify a condition, so I simply specify a condition that can
never be met. The last one simply waits 30 seconds before continuing.


On Wed, Apr 29, 2009 at 4:59 PM, fnord <li...@libertylost.org> wrote:
>
> I've got a situation that I'm trying to script around, and I'm somewhat
> stumped, and hoping someone might have a solution.
>
> I have an array of servers, prod1, prod2, prod3, and prod4.
>
> I'm using a foreach to call restarts of them. Using the parallel parameter,
> this is blazing fast, which is great.
>
> The problem is that I need to pause after the first restart to make sure
> that the application came up properly, then pause for 30 seconds after each
> of the rest.
>
> What I'd like to do is put an "<input>Hit enter when you would like to
> continue</input>" after each of the restarts, but these just end up as part
> of the parallel tasks, which all run at the same time, then it waits for me
> to hit enter 4 times before completing.
>
> Any thoughts on how to implement this? The first pause could be a long time,
> and each of the later ones will be around 30 seconds, as we wait for the
> load balancer to notice that http is not responding on the host.  So having
> an <input> task would be ideal, but I just can't sort a way to get it to
> work.
>
>
> thanks,
> fnord
> --
> View this message in context: http://www.nabble.com/Weird-parallel-for-situation-tp23302387p23302387.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org