def dynamic_server( train_env: TrainEnv, ) -> ContextManager["testutil.ServerFacade"]: serve_env = ServeEnv(train_env.path.base) settings = Settings(sagemaker_server_port=testutil.free_port()) with testutil.temporary_server(serve_env, MeanPredictor, settings) as server: yield server
def static_server( train_env: TrainEnv, ) -> ContextManager["testutil.ServerFacade"]: predictor = MeanPredictor.from_hyperparameters(**train_env.hyperparameters) predictor.serialize(train_env.path.model) serve_env = ServeEnv(train_env.path.base) settings = Settings(sagemaker_server_port=testutil.free_port()) with testutil.temporary_server(serve_env, None, settings) as server: yield server