You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by I am Who i am <ra...@gmail.com> on 2008/05/22 00:27:23 UTC

Ant loop

Hi All,

Is there a way to loop the ant executing on time basis,

eg. Lets say i'm doing db and code deployment in parallel, but i want to
wait for both to be completed before restarting servers for code deployment.
so i thought i would create a flag at the end of db deployment, then at the
end of code deployment process will check for the existence of db-completed
flag, if its available it will set the property "dbcompleted" then in my ant
target i defined it has with if="dbcompleted"

Now this works, ant target won't get executed, if doesn't see property, then
it comes out, but i want to loop it something like, wait for 2mts then try
again,which will go back and see if property available to execute the ant
target

any idea?

RE: Ant loop

Posted by Barry Pape <bp...@netspend.com>.
Maybe the <waitfor> task is what you want:
http://ant.apache.org/manual/index.html


-----Original Message-----
From: I am Who i am [mailto:ragjan@gmail.com] 
Sent: Thursday, May 22, 2008 9:31 AM
To: Ant Users List
Subject: Re: Ant loop

Thanks for answering, may be i was not clear on my question,,, i
actually i
have all these like running db and code deploy to run it parallel, but
most
of the time, my db deploy would take more than code deploy, so i want to
wait db deploy to complete. for this i will create dbcompleted flag at
the
end of db deployment, so my process will have to wait for this flag to
be
available before starting the server, if flag is not available, it has
to
wait for like 1 mts, then try again, this should go in a loop

On Thu, May 22, 2008 at 12:12 AM, David Weintraub <qa...@gmail.com>
wrote:

> Sounds like what you REALLY want to do is the <parallel> task. This
> allows you to specify multiple tasks that can take place at the same
> time. The <parallel> task will wait for each to complete before
> continuing.
>
> There's no need for a flag or a loop.
>
> <target name="db_deploy">
>    <yadda>
>    <yadda>
>    <yadda>
> </target>
>
> <target name="code_deploy">
>    <yadda>
>    <yadda>
>    <yadda>
> </target>
>
> <target name="deploy_and_restart_servers">
>    <parallel>
>       <ant target="db_deploy"/>
>       <ant target="code_deploy"/>
>    </parallel>
>    <yadda task="Start Servers/>
> </target>
>
>
> On Wed, May 21, 2008 at 6:27 PM, I am Who i am <ra...@gmail.com>
wrote:
> > Hi All,
> >
> > Is there a way to loop the ant executing on time basis,
> >
> > eg. Lets say i'm doing db and code deployment in parallel, but i
want to
> > wait for both to be completed before restarting servers for code
> deployment.
> > so i thought i would create a flag at the end of db deployment, then
at
> the
> > end of code deployment process will check for the existence of
> db-completed
> > flag, if its available it will set the property "dbcompleted" then
in my
> ant
> > target i defined it has with if="dbcompleted"
> >
> > Now this works, ant target won't get executed, if doesn't see
property,
> then
> > it comes out, but i want to loop it something like, wait for 2mts
then
> try
> > again,which will go back and see if property available to execute
the ant
> > target
> >
> > any idea?
> >
>
> --
> David Weintraub
> qazwart@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

-----------------------------------------
Confidentiality Notice!
This electronic transmission and any attached documents or other
writings are confidential and are for the sole use of the intended
recipient(s) identified above. This message may contain information
that is privileged, confidential or otherwise protected from
disclosure under applicable law. If the receiver of this
information is not the intended recipient, or the employee, or
agent responsible for delivering the information to the intended
recipient, you are hereby notified that any use, reading,
dissemination, distribution, copying or storage of this information
is strictly prohibited. If you have received this information in
error, please notify the sender by return email and delete the
electronic transmission, including all attachments from your
system.


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


Re: Ant loop

Posted by I am Who i am <ra...@gmail.com>.
Thanks for answering, may be i was not clear on my question,,, i actually i
have all these like running db and code deploy to run it parallel, but most
of the time, my db deploy would take more than code deploy, so i want to
wait db deploy to complete. for this i will create dbcompleted flag at the
end of db deployment, so my process will have to wait for this flag to be
available before starting the server, if flag is not available, it has to
wait for like 1 mts, then try again, this should go in a loop

On Thu, May 22, 2008 at 12:12 AM, David Weintraub <qa...@gmail.com> wrote:

> Sounds like what you REALLY want to do is the <parallel> task. This
> allows you to specify multiple tasks that can take place at the same
> time. The <parallel> task will wait for each to complete before
> continuing.
>
> There's no need for a flag or a loop.
>
> <target name="db_deploy">
>    <yadda>
>    <yadda>
>    <yadda>
> </target>
>
> <target name="code_deploy">
>    <yadda>
>    <yadda>
>    <yadda>
> </target>
>
> <target name="deploy_and_restart_servers">
>    <parallel>
>       <ant target="db_deploy"/>
>       <ant target="code_deploy"/>
>    </parallel>
>    <yadda task="Start Servers/>
> </target>
>
>
> On Wed, May 21, 2008 at 6:27 PM, I am Who i am <ra...@gmail.com> wrote:
> > Hi All,
> >
> > Is there a way to loop the ant executing on time basis,
> >
> > eg. Lets say i'm doing db and code deployment in parallel, but i want to
> > wait for both to be completed before restarting servers for code
> deployment.
> > so i thought i would create a flag at the end of db deployment, then at
> the
> > end of code deployment process will check for the existence of
> db-completed
> > flag, if its available it will set the property "dbcompleted" then in my
> ant
> > target i defined it has with if="dbcompleted"
> >
> > Now this works, ant target won't get executed, if doesn't see property,
> then
> > it comes out, but i want to loop it something like, wait for 2mts then
> try
> > again,which will go back and see if property available to execute the ant
> > target
> >
> > any idea?
> >
>
> --
> David Weintraub
> qazwart@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Ant loop

Posted by David Weintraub <qa...@gmail.com>.
Sounds like what you REALLY want to do is the <parallel> task. This
allows you to specify multiple tasks that can take place at the same
time. The <parallel> task will wait for each to complete before
continuing.

There's no need for a flag or a loop.

<target name="db_deploy">
    <yadda>
    <yadda>
    <yadda>
</target>

<target name="code_deploy">
    <yadda>
    <yadda>
    <yadda>
</target>

<target name="deploy_and_restart_servers">
    <parallel>
       <ant target="db_deploy"/>
       <ant target="code_deploy"/>
    </parallel>
    <yadda task="Start Servers/>
</target>


On Wed, May 21, 2008 at 6:27 PM, I am Who i am <ra...@gmail.com> wrote:
> Hi All,
>
> Is there a way to loop the ant executing on time basis,
>
> eg. Lets say i'm doing db and code deployment in parallel, but i want to
> wait for both to be completed before restarting servers for code deployment.
> so i thought i would create a flag at the end of db deployment, then at the
> end of code deployment process will check for the existence of db-completed
> flag, if its available it will set the property "dbcompleted" then in my ant
> target i defined it has with if="dbcompleted"
>
> Now this works, ant target won't get executed, if doesn't see property, then
> it comes out, but i want to loop it something like, wait for 2mts then try
> again,which will go back and see if property available to execute the ant
> target
>
> any idea?
>

--
David Weintraub
qazwart@gmail.com

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