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: I6a799cc3b59bd7527ace9ee1048bf633dcaa4cd9changes/96/64296/1
parent
e591020290
commit
bd3ecccb94
|
@ -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.")
|
||||
|
|
Loading…
Reference in New Issue