ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hal Hildebrand \(web\)" <Hal.Hildebr...@hellblazer.com>
Subject Re: How to do cleanup with parallel and sequential?
Date Tue, 16 Jul 2002 16:22:32 GMT
I should add that you'll have to use ant-contrib's try-finally task in
combination with this fix to handle the error conditions and continue process as
you describe

----- Original Message -----
From: "Hal Hildebrand (web)" <Hal.Hildebrand@hellblazer.com>

> Attached is a replacement for the Parallel task which fixes this behavior.
> You'll also need to patch the Execute task's waitFor(Process) method as
follows:
>
>     protected void waitFor(Process process) {
>         try {
>             process.waitFor();
>             setExitValue(process.exitValue());
>         } catch (InterruptedException e) {
>             process.destroy();
>         }
>     }
>
> If you don't feel good about just wholesale replacement of the Parallel task
> (we've been using it non stop in our regressions for quite some time now), you
> can just rename the class and use it as an external task.
>
> ----- Original Message -----
> From: "Aaron Siri" <asiri@printcafe.com>
>
>
> > I'm still learning Ant and ran into a problem for which I can't see an
> > obvious (elegant?) solution.
> >
> > The documentation for the parallel and sequential tasks present the
> > following example:
> >
> > <parallel>
> >   <wlrun ...>
> >   <sequential>
> >     <sleep seconds="30"/>
> >     <junit ...>
> >     <wlstop/>
> >   </sequential>
> > </parallel>
> >
> > The problem I see with the example above is that if the <junit ...> task
> > fails then <wlstop/> never gets called which means that <wlrun ...>
will
> > never terminate so the <parallel> (and the rest of the build) never
> > finishes.  Is this right?  If so, how would one get <wlstop/> to execute no
> > matter what <junit ...> does (assuming <junit ...> is an atomic task)
but
> > still have the sequential report failure?
> >
> > An actual build script that exhibits this behavior follows.  Assume that the
> > <waitfor> task is a server process that doesn't time out, that the <fail>
> > task is a unit test against the server that failed, and that the <property>
> > task is what is used to bring down the server.
> >
> > <project name="mytest" default="test" basedir=".">
> > <target name="test">
> > <parallel>
> > <waitfor maxwait="100" maxwaitunit="hour"> <!--
> > start the server -->
> > <isset property="stop"/>
> > </waitfor>
> > <sequential>
> > <fail message="Oh no!"/> <!-- failing unit
> > test -->
> > <property name="stop" value="true"/> <!--
> > stop the server -->
> > </sequential>
> > </parallel>
> > </target>
> > </project>
> >
> > The above will hang indefinitely (well, for 100 hours).
> >
> > Perhaps I'm missing something obvious or there is some built-in task that
> > handles this sort of thing.  Otherwise, could sequential be tweaked to add
> > an attribute that would allow it to keep running tasks even if one fails but
> > still return failure?
> >
> > Any insights or suggestions are appreciated.
> >
> > -Aaron
> >
> > --
> > To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> >
> >
> >
>


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


Mime
View raw message