def _init_node_transition_lib(): """ <Purpose> Perform one-time initialization actions on startup. This will be taken care of automatically, scripts don't need to worry about calling this. <Arguments> None <Exceptions> TimeUpdateError If time update fails in init_nodemanager(). <Side Effects> All necessary initalization is done. <Returns> None """ global is_initialized if not is_initialized: is_initialized = True # Set the log level if we want to override the defaults. #clearinghouse.common.util.log.set_log_level(clearinghouse.common.util.log.LOG_LEVEL_DEBUG) # We don't need to maindb.init_maindb() because that happens automatically # when django creates a new database connection. nodemanager.init_nodemanager() backend.set_backend_authcode(clearinghouse.backend.config.authcode)
def main(): # Initialize the main database. maindb.init_maindb() # Initialize the key database. keydb.init_keydb() # Initialize the nodemanager. nodemanager.init_nodemanager() # Start the background thread that does vessel cleanup. thread.start_new_thread(cleanup_vessels, ()) # Start the background thread that does vessel user key synchronization. thread.start_new_thread(sync_user_keys_of_vessels, ()) # Register the XMLRPCServer. Use allow_none to allow allow the python None value. server = ThreadedXMLRPCServer(("127.0.0.1", LISTENPORT), allow_none=True) log.info("Backend listening on port " + str(LISTENPORT) + ".") server.register_instance(BackendPublicFunctions()) while True: server.handle_request()