Not sure I understand I now do:

    for (int i = 0; i < 4; i++) {
      try {
        QueueTaskFuture<?> scheduleBuild2 = project.scheduleBuild2(0, new 
Cause.UserCause(), myActions[i]);
        queue.add(scheduleBuild2);
      } catch (Exception e) {
        throw new AbortException(e.getMessage());
      }
    }

    for (QueueTaskFuture<?> q : queue) {
      q.get();
    }


I need to get the results from each job and print some info but it still 
does not execute in parallel. 

I also found this:

Queue$Item item = Jenkins.getInstance().getQueue().schedule2(null, 0, 
 myActions[i])

But I still does not give me what I want.


On Sunday, March 9, 2014 10:32:31 PM UTC+1, Daniel Beck wrote:
>
> Don't immediately call .get(), instead assign the Future returned from 
> scheduleBuild2 to a variable. Only .get() once you're willing to wait for 
> the build to complete. 
>
> On 09.03.2014, at 22:27, dev123 <delb...@gmail.com <javascript:>> wrote: 
>
> > In a jenkins plugin I am writing I need to run 5 jobs in parallel. 
> Currently I do (sequentially): 
> > 
> >     for (int i = 0; i < 4; i++) { 
> >       try { 
> >         build = project.scheduleBuild2(0, new Cause.UserCause(), 
> myActions[i]).get(); 
> >       } catch (Exception e) { 
> >         throw new AbortException(e.getMessage()); 
> >       }       
> >     } 
> > 
> > How do I trigger these jobs to run in parallel - each one on a separate 
> executor? 
> > 
> > 
> > -- 
> > 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-use...@googlegroups.com <javascript:>. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
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/d/optout.

Reply via email to