Trees | Indices | Help |
|
---|
|
1 # This file is part of Buildbot. Buildbot is free software: you can 2 # redistribute it and/or modify it under the terms of the GNU General Public 3 # License as published by the Free Software Foundation, version 2. 4 # 5 # This program is distributed in the hope that it will be useful, but WITHOUT 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 8 # details. 9 # 10 # You should have received a copy of the GNU General Public License along with 11 # this program; if not, write to the Free Software Foundation, Inc., 51 12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 13 # 14 # Copyright Buildbot Team Members 15 16 from zope.interface import implements 17 from twisted.application import service 18 from twisted.internet import defer, task 19 from twisted.python import log 20 21 from buildbot.interfaces import IChangeSource 22 from buildbot import util 23 2931 """ 32 Utility subclass for ChangeSources that use some kind of periodic polling 33 operation. Subclasses should define C{poll} and set C{self.pollInterval}. 34 The rest is taken care of. 35 """ 36 37 pollInterval = 60 38 "time (in seconds) between calls to C{poll}" 39 40 _loop = None 41 volatile = ['_loop'] # prevents Twisted from pickling this value 4258 6244 """ 45 Perform the polling operation, and return a deferred that will fire 46 when the operation is complete. Failures will be logged, but the 47 method will be called again after C{pollInterval} seconds. 48 """4951 ChangeSource.startService(self) 52 def do_poll(): 53 d = defer.maybeDeferred(self.poll) 54 d.addErrback(log.err) 55 return d56 self._loop = task.LoopingCall(do_poll) 57 self._loop.start(self.pollInterval)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Dec 19 18:26:48 2010 | http://epydoc.sourceforge.net |