(replying to myself) On reflection, http://javadoc.jenkins-ci.org/hudson/model/queue/QueueListener.html may be better bet; examining the item passed to onLeft() should tell you if something is actually being built or not.
On Thu, Oct 31, 2013 at 9:31 AM, Marc MacIntyre <[email protected]>wrote: > Rather than watching the individual slaves and jobs, can't you watch the > queue, and if it's empty for longer than your timeout, start your idle job? > > It's possible that extending > http://javadoc.jenkins-ci.org/hudson/model/Queue.QueueDecisionHandler.htmlwill > do the trick; reset your timer every time something tries to enter the > queue, and fire off a periodic task ( > http://javadoc.jenkins-ci.org/hudson/model/PeriodicWork.html) to check > the timer every once in a while. > > This wouldn't be perfect, as the decisionhandler may not know if the > submitted job ever actually gets queued (someone else may reject it), but > it may meet your needs. > > > On Thu, Oct 31, 2013 at 9:24 AM, Ronald B <[email protected]> wrote: > >> Hi, I'm new to jenkins and new to writing plugins. >> >> I'm trying to write and IdleTrigger that triggers a build when Jenkins >> has been idle. >> (its a complex use case, but essentially I want wait for everything to be >> quiet before doing something.) >> An IdleTrigger may not be the best way to solve this problem, but I want >> to learn a little >> more about Jenkins internals anyway. >> >> I think there are (at least) two approaches: >> 1) Simply get all the Computers and call getIdleStartMilliseconds() to >> make sure they have >> all be idle. >> >> 2) Add a RunListener and possibly other Listeners to find out when jobs >> start/stop. >> When no jobs are running, start the idle timer. When a job starts, >> kill the timer. >> >> Conceptually, is one approach better than the other? Or is there a >> better way? >> >> Thanks. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Jenkins Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > Marc MacIntyre > -- Marc MacIntyre -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
