def getSchedulerByName(self, name): # we use the fact that scheduler_manager is a multiservice, with schedulers as childs # this allow to quickly find schedulers instance by name schedulers = self.master.scheduler_manager.namedServices if name not in schedulers: raise ValueError("unknown triggered scheduler: %r" % (name,)) sch = schedulers[name] if not ITriggerableScheduler.providedBy(sch): raise ValueError("triggered scheduler is not ITriggerableScheduler: %r" % (name,)) return sch
def getSchedulerByName(self, name): # Use a quick cache to avoid generating this dict every time. all_schedulers = self._all_schedulers if all_schedulers is None: all_schedulers = self.build.builder.botmaster.parent.allSchedulers() all_schedulers = dict([(sch.name, sch) for sch in all_schedulers]) self._all_schedulers = all_schedulers sch = all_schedulers.get(name) if sch is not None: if ITriggerableScheduler.providedBy(sch): return sch return None
def getSchedulerByName(self, name): # Use a quick cache to avoid generating this dict every time. all_schedulers = self._all_schedulers if all_schedulers is None: all_schedulers = self.build.builder.botmaster.parent.allSchedulers( ) all_schedulers = dict([(sch.name, sch) for sch in all_schedulers]) self._all_schedulers = all_schedulers sch = all_schedulers.get(name) if sch is not None: if ITriggerableScheduler.providedBy(sch): return sch return None
def getSchedulers(self): all_schedulers = self.build.builder.botmaster.parent.allSchedulers() all_schedulers = dict([(sch.name, sch) for sch in all_schedulers]) invalid_schedulers = [] triggered_schedulers = [] # don't fire any schedulers if we discover an unknown one for scheduler in self.schedulerNames: scheduler = scheduler if all_schedulers.has_key(scheduler): sch = all_schedulers[scheduler] if ITriggerableScheduler.providedBy(sch): triggered_schedulers.append(sch) else: invalid_schedulers.append(scheduler) else: invalid_schedulers.append(scheduler) return (triggered_schedulers, invalid_schedulers)
def getSchedulers(self): all_schedulers = self.build.builder.botmaster.parent.allSchedulers() all_schedulers = dict([(sch.name, sch) for sch in all_schedulers]) invalid_schedulers = [] triggered_schedulers = [] # don't fire any schedulers if we discover an unknown one for scheduler in self.schedulerNames: scheduler = scheduler if scheduler in all_schedulers: sch = all_schedulers[scheduler] if ITriggerableScheduler.providedBy(sch): triggered_schedulers.append(sch) else: invalid_schedulers.append(scheduler) else: invalid_schedulers.append(scheduler) return (triggered_schedulers, invalid_schedulers)