def setup(self, opts, restrict=None, shelveoperators=False, cache=True, raw=False): self.load_chunk_size = datetime.timedelta(hours=int(opts.get('ChunkSize', 24))) self.source_url = opts.get('SourceUrl', 'http://new.openbms.org/backend') # self.source_url = opts.get('SourceUrl', 'http://ar1.openbms.org:8079') if not raw and restrict: self.restrict = '(' + restrict + ') and not has Metadata/Extra/Operator' else: self.restrict = restrict if shelveoperators: self.operators = shelve.open(opts.get('OperatorCache', '.operators'), protocol=2, writeback=True) # sync the operator state periodically and at exit util.periodicCallInThread(self.operators.sync).start(60) reactor.addSystemEventTrigger('after', 'shutdown', self.operators.close) else: self.operators = {} self.oplist = [] self.arclient = SmapClient(self.source_url) self.cache = cache # create timeseries from cached operator state for sid, oplist in self.operators.iteritems(): for path, op in oplist.itervalues(): self.add_operator(path, op)
def start(self): """Causes the reporting subsystem and any drivers to be started """ map(lambda x: x.start(), self.drivers.itervalues()) # set all checkers that loader has hooked in to be run on the # given interval checkstarter = lambda period, checker: util.periodicCallInThread(checker).start(period) for args in self.checkers: # wait 300 seconds to start each checker, to prevent startup lag from # throwing off the checkers reactor.callLater(2, checkstarter, *args)
def start(self): periodicCallInThread(self.update).start(60 * 2.5)
def start(self): util.periodicCallInThread(self.update).start(self.rate)