code: 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(),
          model_server_workers=1,
      )
      with testutil.temporary_server(
          serve_env, None, settings
      ) as server:
          yield server
  
imports: import json
  import logging
  import sys
  from typing import ContextManager
  import numpy
  import pytest
  from gluonts.core.component import equals
  from gluonts.dataset.jsonl import encode_json
  from gluonts.model.trivial.mean import MeanPredictor
  from gluonts.shell.env import ServeEnv, TrainEnv
  from gluonts.shell.train import run_train_and_test
label_desc: Use image node_id 2 for calling a global function with example usage: static_server(train_env) without return types