Hi Åsmund ,

KillRunningjobs is called internally if the flow is aborted (or one of the jobs 
is aborted).
Internallyt this is handled by catching either  (IIRC) a JobAborteException (or 
also an IOException).
The IOException will show a stack trace in your console output - wheres the 
jobAbortEx will just show "Aborted" (and the cause if you set one),
So just throw one of those.  I guess I should add this to the extensions so you 
can just call ext.abortFlow("Reason") :)

Also no need to check the string - check getResult() == Result.FAILURE or 
getResult().isWorseOrEqual(Result.FAILURE)

/James

From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of Åsmund Østvold
Sent: 24 October 2013 14:28
To: jenkinsci-users@googlegroups.com
Subject: Re: build flow, early exit from parallel construct?

thank you James,

I will have a look at the new code tomorrow.

What I have now is:
parallel(
 {  b = build("pass");
    if (b.getResult().toString() == "FAILURE") {
        build.doStop();
    }},
 {  b = build( "fail" );
    if (b.getResult().toString() == "FAILURE") {
        build.doStop();
    }}
)

What I think I would like to be able to call is:

     private void killRunningJobs(FlowRun flowRun, BuildListener listener)

Asmund



On Thu, Oct 24, 2013 at 9:55 PM, James Nord (jnord) 
<jn...@cisco.com<mailto:jn...@cisco.com>> wrote:
I think I made some changes in the code that may be able to help with this by 
chaining the abort to the rest of the build.

If you combine this with some groovy to abort the build (by throwing the 
relavant exception) then the jobs in progress should be aborted.

You will need to get the latest code and build it.

As always there may be other ways to achieve the same thing.

Regards,

/James

From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> 
[mailto:jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>]
 On Behalf Of Åsmund Østvold
Sent: 24 October 2013 08:22
To: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>
Subject: build flow, early exit from parallel construct?

Build Flow Plugin very useful plugging.

Is it possible to get the parallel construct to "terminate" still executing 
jobs at first job exiting with none success? Or at least early fail the 
job/section containing the parallel construct.

Use case is that I have a total long(30min) check-in regression test time. Some 
tests finishes in 2 min some take 30 min. Because of early feedback and 
resources issues I would like to fail a change as early as possible.

Asmund

--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users%2bunsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to