def run(callback): db = Db() datalib.db = db init = db.startService() init.addCallback(callback) reactor.run()
def run(): config.read() config.LOG_DIRECTORY = "stdout" log.startLogging(sys.stdout) db = Db() db.startService().addCallback(convert) reactor.run()
def run(): config.read() logs.checker_master() top_service = TopService() db = Db() datalib.db = db db.setServiceParent(top_service) sub_service = MasterService(db) sub_service.setServiceParent(top_service) top_service.startService() reactor.addSystemEventTrigger('before', 'shutdown', top_service.stopService) reactor.run()
def run(): config.read() logs.api() top_service = service.MultiService() db = Db() datalib.db = db db.setServiceParent(top_service) http_service = internet.TCPServer(config.HTTP_PORT, Site(db), interface=config.HTTP_ADDR) http_service.setServiceParent(top_service) top_service.startService() reactor.addSystemEventTrigger('before', 'shutdown', top_service.stopService) reactor.run()
trigger["is_simple_trigger"] = is_simple_trigger logs.log.info(str(trigger["is_simple_trigger"])) yield db.saveTrigger(trigger_id, trigger) converted_triggers_count += 1 if is_simple_trigger: simple_triggers_count += 1 else: complex_triggers_count += 1 except Exception, e: failed_triggers_count += 1 logs.log.error("conversion failed for trigger: %s" % e) logs.log.info("%d triggers converted, %d simple, %d complex, %d failed" % (converted_triggers_count, simple_triggers_count, complex_triggers_count, failed_triggers_count)) reactor.stop() if __name__ == '__main__': config.read() logs.checker_worker() db = Db() datalib.db = db init = db.startService() init.addCallback(migrate_triggers) reactor.run()