Re: ScheduleBuild2 and determining if job was never started.

2016-05-20 Thread 'Niksan' via Jenkins Users
And it turns out that code was splodge, man, so tedious. :D Anyhoo, for reference and if anyone else finds it useful, the correct, more lightweight solution is def triggerJob( jobToTrigger, cause, parameters ) { def currentJobFutures = Jenkins.getInstance().getQueue().getItems(

Re: ScheduleBuild2 and determining if job was never started.

2016-05-20 Thread 'Niksan' via Jenkins Users
Ok, thanks to Daniel with the initial pointers I was able to start hunting down the correct path at least. Short of not being able to lock the queue, it will suffice. The future has a variable in there called 'task' I didn't see this in the docs at all and saw it doing a .dump() of the object,

Re: ScheduleBuild2 and determining if job was never started.

2016-05-20 Thread Daniel Beck
> On 20.05.2016, at 13:41, 'Niksan' via Jenkins Users > wrote: > > Also, how is one supposed to getId() from a hudson.model.queue.FutureImpl > exactly? I mentioned the wrong method signature, I was referring to static

Re: ScheduleBuild2 and determining if job was never started.

2016-05-20 Thread 'Niksan' via Jenkins Users
Also, how is one supposed to getId() from a hudson.model.queue.FutureImpl exactly? On Thursday, May 19, 2016 at 8:09:22 PM UTC+1, Daniel Beck wrote: > > > > On 19.05.2016, at 15:37, 'Niksan' via Jenkins Users < > jenkins...@googlegroups.com > wrote: > > > > So, you can fire jobs off in Groovy

Re: ScheduleBuild2 and determining if job was never started.

2016-05-20 Thread 'Niksan' via Jenkins Users
I did some tests and it appears to merge, or rather, schedulebuild2 just returns the instance of the already queued job from a previous scheduledbuild2 as you suggested, that's incredibly annoying, so I guess one has to take a snapshot of the build queue then schedulebuild2, if it's already in

Re: ScheduleBuild2 and determining if job was never started.

2016-05-20 Thread 'Niksan' via Jenkins Users
I'm not sure under what circumstances an item merge occurs, but that would be problematic, as it would be waiting on someone else's job and tying a node up needlessly. Scraping though the code on GitHub last night I saw there is a check to see if scheduling should happen, one of the simple

Re: ScheduleBuild2 and determining if job was never started.

2016-05-19 Thread Daniel Beck
> On 19.05.2016, at 15:37, 'Niksan' via Jenkins Users > wrote: > > So, you can fire jobs off in Groovy using ScheduleBuild2 which returns a > future. By its nature, Jenkins will purge any duplicate build requests at > some point.

ScheduleBuild2 and determining if job was never started.

2016-05-19 Thread 'Niksan' via Jenkins Users
So, you can fire jobs off in Groovy using ScheduleBuild2 which returns a future. By its nature, Jenkins will purge any duplicate build requests at some point. How can we tell given a future if that job was purged by Jenkins itself to know it never actually ran? Or does that future return that