def __init__(self, store_uri=None, port=_PORT, start_default_notification: bool = True, notification_uri=None, ha_manager=None, server_uri=None, ha_storage=None, ttl_ms: int = 10000): super(HighAvailableAIFlowServer, self).__init__(store_uri, port, start_default_notification, notification_uri) if ha_manager is None: ha_manager = SimpleAIFlowServerHaManager() if server_uri is None: raise ValueError("server_uri is required!") if ha_storage is None: db_engine = extract_db_engine_from_uri(store_uri) if DBType.value_of(db_engine) == DBType.MONGODB: username, password, host, port, db = parse_mongo_uri(store_uri) ha_storage = MongoStore(host=host, port=int(port), username=username, password=password, db=db) else: ha_storage = SqlAlchemyStore(store_uri) self.ha_service = HighAvailableService(ha_manager, server_uri, ha_storage, ttl_ms) add_HighAvailabilityManagerServicer_to_server(self.ha_service, self.server)
def __init__(self, backend_store_uri): db_engine = extract_db_engine_from_uri(backend_store_uri) if DBType.value_of(db_engine) == DBType.MONGODB: username, password, host, port, db = parse_mongo_uri( backend_store_uri) super().__init__(storage=MongoEventStorage(host=host, port=int(port), username=username, password=password, db=db)) else: super().__init__(storage=DbEventStorage(backend_store_uri))
def __init__(self, db_uri, server_uri): db_engine = extract_db_engine_from_uri(db_uri) if DBType.value_of(db_engine) == DBType.MONGODB: username, password, host, port, db = parse_mongo_uri(db_uri) self.store = MongoStore(host=host, port=int(port), username=username, password=password, db=db) else: self.store = SqlAlchemyStore(db_uri) self.model_center_client = ModelCenterClient(server_uri)
def __init__(self, db_uri): self.db_uri = db_uri db_engine = extract_db_engine_from_uri(self.db_uri) if DBType.value_of(db_engine) == DBType.MONGODB: username, password, host, port, db = parse_mongo_uri(self.db_uri) self.store = MongoStore(host=host, port=int(port), username=username, password=password, db=db) else: self.store = SqlAlchemyStore(self.db_uri)
def __init__(self, store_uri, server_uri, notification_uri=None): db_engine = extract_db_engine_from_uri(store_uri) if DBType.value_of(db_engine) == DBType.MONGODB: username, password, host, port, db = parse_mongo_uri(store_uri) self.model_repo_store = MongoStore(host=host, port=int(port), username=username, password=password, db=db) else: self.model_repo_store = SqlAlchemyStore(store_uri) if notification_uri is None: self.notification_client = NotificationClient(server_uri) else: self.notification_client = NotificationClient(notification_uri)