def __init__(self, session: ErSession): if session.get_session_meta()._status != SessionStatus.ACTIVE: raise Exception( f"session_id={session.get_session_id()} is not ACTIVE. current status={session.get_session_meta()._status}" ) self.__session = session self.session_id = session.get_session_id() default_store_type_str = RollPairConfKeys.EGGROLL_ROLLPAIR_DEFAULT_STORE_TYPE.get_with( session.get_all_options()) self.default_store_type = getattr(StoreTypes, default_store_type_str, None) if not self.default_store_type: raise ValueError( f'store type "{default_store_type_str}" not found for roll pair' ) self.in_memory_output = RollPairConfKeys.EGGROLL_ROLLPAIR_IN_MEMORY_OUTPUT.get_with( session.get_all_options()) if not self.default_store_type: raise ValueError( f'in_memory_output "{self.in_memory_output}" not found for roll pair' ) self.default_store_serdes = SerdesTypes.PICKLE self.__session_meta = session.get_session_meta() self.__session.add_exit_task(self.context_gc) self.rpc_gc_enable = True self.gc_recorder = GcRecorder(self) self.__command_client = CommandClient() self.session_default_rp = self.load(name=self.session_id, namespace=f'er_session_meta', options={ 'total_partitions': session.get_eggs_count(), 'store_type': StoreTypes.ROLLPAIR_CACHE, 'create_if_missing': True }) eggs = session.get_eggs() def _broadcast_eggs(task: ErTask): from eggroll.core.utils import add_runtime_storage _input = task._inputs[0] add_runtime_storage("__eggs", eggs) L.debug(f"runtime_storage={get_runtime_storage('__eggs')}") self.session_default_rp.with_stores(func=_broadcast_eggs)
def __init__(self, session: ErSession): if session.get_session_meta()._status != SessionStatus.ACTIVE: raise Exception(f"session_id={session.get_session_id()} is not ACTIVE. current status={session.get_session_meta()._status}") self.__session = session self.session_id = session.get_session_id() default_store_type_str = RollPairConfKeys.EGGROLL_ROLLPAIR_DEFAULT_STORE_TYPE.get_with(session.get_all_options()) self.default_store_type = getattr(StoreTypes, default_store_type_str, None) if not self.default_store_type: raise ValueError(f'store type "{default_store_type_str}" not found for roll pair') self.default_store_serdes = SerdesTypes.PICKLE self.deploy_mode = session.get_option(SessionConfKeys.CONFKEY_SESSION_DEPLOY_MODE) self.__session_meta = session.get_session_meta() self.__session.add_exit_task(self.context_gc) self.rpc_gc_enable = True self.gc_recorder = GcRecorder(self) self.__command_client = CommandClient()
def __init__(self, session: ErSession): if session.get_session_meta()._status != SessionStatus.ACTIVE: raise Exception( f"session:{session.get_session_id()} is not available, init first!" ) self.__session = session self.session_id = session.get_session_id() self.default_store_type = StoreTypes.ROLLPAIR_LMDB self.default_store_serdes = SerdesTypes.PICKLE self.deploy_mode = session.get_option( SessionConfKeys.CONFKEY_SESSION_DEPLOY_MODE) self.__session_meta = session.get_session_meta() self.__session.add_exit_task(self.context_gc) self.rpc_gc_enable = True self.gc_recorder = GcRecorder(self) self.__command_client = CommandClient()
def __init__(self, session: ErSession): self.__session = session self.session_id = session.get_session_id() self.default_store_type = StoreTypes.ROLLPAIR_LMDB self.default_store_serdes = SerdesTypes.PICKLE self.deploy_mode = session.get_option( SessionConfKeys.CONFKEY_SESSION_DEPLOY_MODE) self.__session_meta = session.get_session_meta() self.__session.add_exit_task(self.context_gc) self.rpc_gc_enable = True self.gc_recorder = GcRecorder(self)