Use forced_pipeline with timer events

As it stands, if multiple pipelines
have timers with the same timespec, they will all respond to
the events generated for all of them.

Instead of matching on the timespec, associate a timer trigger
with a pipeline directly.

Change-Id: I6a799cc3b59bd7527ace9ee1048bf633dcaa4cd9
This commit is contained in:
James E. Blair 2013-12-27 10:38:35 -08:00
parent e591020290
commit bd3ecccb94
1 changed files with 4 additions and 2 deletions

View File

@ -28,11 +28,12 @@ class Timer(object):
self.apsched = apscheduler.scheduler.Scheduler()
self.apsched.start()
def _onTrigger(self, timespec):
def _onTrigger(self, pipeline_name, timespec):
for project in self.sched.layout.projects.values():
event = TriggerEvent()
event.type = 'timer'
event.timespec = timespec
event.forced_pipeline = pipeline_name
event.project_name = project.name
self.log.debug("Adding event %s" % event)
self.sched.addEvent(event)
@ -78,7 +79,8 @@ class Timer(object):
hour=hour,
minute=minute,
second=second,
args=(timespec,))
args=(pipeline.name,
timespec,))
def getChange(self, number, patchset, refresh=False):
raise Exception("Timer trigger does not support changes.")