def __init__(self): Plugin.__init__(self, name='scenario', log_prefix='core_') ### check that needed services are up on MQ side cli = MQSyncReq(zmq.Context()) mq_services = None while mq_services == None or 'xplgw' not in mq_services: mq_services_raw = cli.rawrequest('mmi.services', '', timeout=10) if mq_services_raw != None: mq_services = str(mq_services_raw[0]).replace(" ", "").split(",") self.log.info("Checking for MQ services : {0}".format(mq_services)) if mq_services == None or 'xplgw' not in mq_services: self.log.debug( "Needed MQ services not yet available : waiting") time.sleep(3) self.log.info("Needed MQ services available : continuing startup") ### start the scenario stuff self._backend = ScenarioManager(self.log) self.add_stop_cb(self.end) self.add_stop_cb(self.shutdown) self.log.info( u"Scenario Frontend and Manager initialized, let's wait for some work." ) self.ready()
def __init__(self): Plugin.__init__(self, name = 'scenario') self._backend = ScenarioManager(self.log) self.add_stop_cb(self.end) self.add_stop_cb(self.shutdown) self.log.info(u"Scenario Frontend and Manager initialized, let's wait for some work.") self.ready()
def __init__(self): Plugin.__init__(self, name='scenario') self._backend = ScenarioManager(self.log) self.add_stop_cb(self.end) self.add_stop_cb(self.shutdown) self.log.info( u"Scenario Frontend and Manager initialized, let's wait for some work." ) self.ready()
def __init__(self): ''' Initialize database and xPL connection ''' Plugin.__init__(self, 'dbmgr', log_prefix='core_') # Already done in Plugin #MQRep.__init__(self, zmq.Context(), 'dbmgr') self.log.debug(u"Init database_manager instance") # Check for database connexion self._db = DbHelper() with self._db.session_scope(): # TODO : move in a function and use it (also used in dbmgr) nb_test = 0 db_ok = False while not db_ok and nb_test < DATABASE_CONNECTION_NUM_TRY: nb_test += 1 try: self._db.list_user_accounts() db_ok = True except: msg = "The database is not responding. Check your configuration of if the database is up. Test {0}/{1}. The error while trying to connect to the database is : {2}".format( nb_test, DATABASE_CONNECTION_NUM_TRY, traceback.format_exc()) self.log.error(msg) msg = "Waiting for {0} seconds".format( DATABASE_CONNECTION_WAIT) self.log.info(msg) time.sleep(DATABASE_CONNECTION_WAIT) if nb_test >= DATABASE_CONNECTION_NUM_TRY: msg = "Exiting dbmgr!" self.log.error(msg) self.force_leave() return msg = "Connected to the database" self.log.info(msg) try: self._engine = self._db.get_engine() except: self.log.error( u"Error while starting database engine : {0}".format( traceback.format_exc())) self.force_leave() return self.ready()
def __init__(self): ''' Initialize database and xPL connection ''' Plugin.__init__(self, 'dbmgr', log_prefix='core_') # Already done in Plugin #MQRep.__init__(self, zmq.Context(), 'dbmgr') self.log.debug(u"Init database_manager instance") # Check for database connexion self._db = DbHelper() with self._db.session_scope(): # TODO : move in a function and use it (also used in dbmgr) nb_test = 0 db_ok = False while not db_ok and nb_test < DATABASE_CONNECTION_NUM_TRY: nb_test += 1 try: self._db.list_user_accounts() db_ok = True except: msg = "The database is not responding. Check your configuration of if the database is up. Test {0}/{1}. The error while trying to connect to the database is : {2}".format(nb_test, DATABASE_CONNECTION_NUM_TRY, traceback.format_exc()) self.log.error(msg) msg = "Waiting for {0} seconds".format(DATABASE_CONNECTION_WAIT) self.log.info(msg) time.sleep(DATABASE_CONNECTION_WAIT) if nb_test >= DATABASE_CONNECTION_NUM_TRY: msg = "Exiting dbmgr!" self.log.error(msg) self.force_leave() return msg = "Connected to the database" self.log.info(msg) try: self._engine = self._db.get_engine() except: self.log.error(u"Error while starting database engine : {0}".format(traceback.format_exc())) self.force_leave() return self.ready()
def __init__(self): Plugin.__init__(self, name = 'scenario') ### check that needed services are up on MQ side cli = MQSyncReq(zmq.Context()) mq_services = None while mq_services == None or 'xplgw' not in mq_services: mq_services_raw = cli.rawrequest('mmi.services', '', timeout=10) if mq_services_raw != None: mq_services = mq_services_raw[0].replace(" ", "").split(",") self.log.info("Checking for MQ services : {0}".format(mq_services)) if mq_services == None or 'xplgw' not in mq_services: self.log.debug("Needed MQ services not yet available : waiting") time.sleep(3) self.log.info("Needed MQ services available : continuing startup") ### start the scenario stuff self._backend = ScenarioManager(self.log) self.add_stop_cb(self.end) self.add_stop_cb(self.shutdown) self.log.info(u"Scenario Frontend and Manager initialized, let's wait for some work.") self.ready()