I don't know... This looks preaty much like scripting. ;-) I think we need to put some more thought on how do we want <parallel> and <sequential> tasks to interact with each other and with the build process itself.
For example, what should a parallel branch of the build do when another branch receives a BuildException? In a plain sequential build the only accion is to stop the build. We all know all the discussions about whether having an "onerror" target or using buildlisteners to detect failures. How does that discussion deals with parallelized builds? I think we are seeing another aspect of the same issue here, but mascaraded by the fact that we have things going on in parallel. And then we have the regular issues of how to manage threads in general <join>, <kill> <wait>, <timelimit>, etc. Do we really need all that? Can we get most of the same with less tasks? I think we need to start a *nice* thread of discussion about this issues and design it properly, as oppose to just try to solve the problem for particular examples. Don't get me wrong, examples are useful to test the usefulness of a proposal, but we need to understand how all the pieces work toguether and any other unforseen concequenses. Thoughts? Jose Alberto ----- Original Message ----- From: "Ken Wood" <[EMAIL PROTECTED]> To: "Ant Developers List" <[EMAIL PROTECTED]> Cc: "Ant Users List" <[email protected]> Sent: Monday, October 29, 2001 2:54 PM Subject: Re: Problem with parallel mode > 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:[EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
