ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Wood <kw...@i2.com>
Subject Re: Problem with parallel mode
Date Mon, 29 Oct 2001 14:54:34 GMT
I was wrestling with a similar issue last week.

I start weblogic in one 'parallel' branch, and run
test cases in another branch. When the test cases
end, they shutdown the server. But, sometimes the
test cases get hung, and the build never ends.

I had thought of doing a "sleep hours=1" in a third branch,
followed by the code to stop the weblogic server. Now, in
the case where the branch that runs the tests against
the servers gets hung up for some reason, this time out
branch would shut down the server. But, it wouldn't stop
the hung test branch. And, if the test branch succeeded,
the 'sleep' branch would keep the build running for whatever
remains of the 1 hour timeout. So, I didn't pursue it...

What I wanted was to have an 'kill' that I could use.
If the 'sleep' branch got to the end of the sleep, it would
then run the code to cleanly shutdown the server and to
'kill' the hung test code. And, if the test code branch
finished first, it would shutdown the server cleanly (as
it already does) and then 'kill' the timeout branch that
is still sleeping. An example:

<parallel>

   <sequential id="server">
      code to start the server
   </sequential>

   <sequential id="tests">
       code to run tests
       code to stop server
       <kill refid="sleep"/>
   </sequential>

   <sequential id="sleep">
     <sleep hours="1"/>
     code to stop server
     <kill refid="tests"/>
   </sequential>

</parallel>

Now, to deal with the original issue raised, we need to
be able to catch an exception that happens when a failure
occurs. How about this:

<sequential id="tests">
  <catch> 
    code to stop server
    <kill refid="sleep"/>
  </catch>
  code to run tests
  code to stop server
  <kill refid="sleep"/>
</sequential>


The code declared within <catch> would only be executed if
a build failure exception was thrown during the running
of the tests. 
  
Conor MacNeill wrote:
> 
> I'm copying this over to Ant-dev. Please follow up there
> 
> Quintus, Guenter wrote:
> 
> > Hi all,
> >
> > i am running ant 1.4 using the parallel tag.
> > Weblogic is started in one branch, in the second some test cases are
> > runned and there is also a stop method for the weblogic task.
> > But if there is an error at testing ant will still stop the execution
> > for branch 2 which is ok but weblogic is still running at branch 1.
> > Is there a way to tell ant to stop every branch in case of an error?
> >
> 
> There are a few issues here. Firstly, this would need to be configurable
> I guess ("one dead - all dead" versus "dead thread does not affect other
> threads"). The other issue is that Ant doesn't actually know how to
> "stop" the Weblogic process.
> 
> We could explore allowing some tasks, particularly tasks based on
> embedded <exec>'s to be terminated. In the case of <parallel>, it could
> use Thread.interrupt() to break the waitFor() call in Execute. In that
> case the InterruptedException catch should forcibly terminate the
> process. The logic in <parallel> would need to be updated a bit too.
> 
> Thoughts anyone? I'll try this out this week sometime.
> 
> Conor
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-dev-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