code: def test_multi_data_model_deploy_train_model_from_amazon_first_party_estimator(
      container_image, sagemaker_session, cpu_instance_type
  ):
      timestamp = sagemaker_timestamp()
      endpoint_name = "test-multimodel-endpoint-{}".format(timestamp)
      model_name = "test-multimodel-{}".format(timestamp)
  
      with timeout_and_delete_endpoint_by_name(
          endpoint_name, sagemaker_session
      ):
          rcf_model_v1 = __rcf_training_job(
              sagemaker_session,
              container_image,
              cpu_instance_type,
              50,
              20,
          )
  
          model_data_prefix = os.path.join(
              "s3://",
              sagemaker_session.default_bucket(),
              "multimodel-{}/".format(timestamp),
          )
          multi_data_model = MultiDataModel(
              name=model_name,
              model_data_prefix=model_data_prefix,
              model=rcf_model_v1,
              sagemaker_session=sagemaker_session,
          )
  
          # Add model before deploy
          multi_data_model.add_model(
              rcf_model_v1.model_data, PRETRAINED_MODEL_PATH_1
          )
          # Deploy model to an endpoint
          multi_data_model.deploy(
              1, cpu_instance_type, endpoint_name=endpoint_name
          )
          # Train another model
          rcf_model_v2 = __rcf_training_job(
              sagemaker_session,
              container_image,
              cpu_instance_type,
              70,
              20,
          )
          # Deploy newly trained model
          multi_data_model.add_model(
              rcf_model_v2.model_data, PRETRAINED_MODEL_PATH_2
          )
  
          # List model assertions
          endpoint_models = []
          for model_path in multi_data_model.list_models():
              endpoint_models.append(model_path)
          assert PRETRAINED_MODEL_PATH_1 in endpoint_models
          assert PRETRAINED_MODEL_PATH_2 in endpoint_models
  
          # Define a predictor to set `serializer` parameter with `NumpySerializer`
          # instead of `JSONSerializer` in the default predictor returned by `MXNetPredictor`
          # Since we are using a placeholder container image the prediction results are not accurate.
          predictor = Predictor(
              endpoint_name=endpoint_name,
              sagemaker_session=sagemaker_session,
              serializer=NumpySerializer(),
              deserializer=string_deserializer,
          )
  
          data = numpy.random.rand(1, 14)
          # Prediction result for the first model
          result = predictor.predict(
              data, target_model=PRETRAINED_MODEL_PATH_1
          )
          assert result == "Invoked model: {}".format(
              PRETRAINED_MODEL_PATH_1
          )
  
          # Prediction result for the second model
          result = predictor.predict(
              data, target_model=PRETRAINED_MODEL_PATH_2
          )
          assert result == "Invoked model: {}".format(
              PRETRAINED_MODEL_PATH_2
          )
  
          # Cleanup
          sagemaker_session.sagemaker_client.delete_endpoint_config(
              EndpointConfigName=endpoint_name
          )
          multi_data_model.delete_model()
      with pytest.raises(Exception) as exception:
          sagemaker_session.sagemaker_client.describe_model(
              ModelName=model_name
          )
          assert "Could not find model" in str(exception.value)
          sagemaker_session.sagemaker_client.describe_endpoint_config(
              name=endpoint_name
          )
          assert "Could not find endpoint" in str(exception.value)
  
imports: from __future__ import absolute_import
  import base64
  import os
  import requests
  import docker
  import numpy
  import pytest
  from tests.integ.utils import create_repository
  from sagemaker import utils
  from sagemaker.amazon.randomcutforest import RandomCutForest
  from sagemaker.deserializers import StringDeserializer
  from sagemaker.multidatamodel import MultiDataModel
  from sagemaker.mxnet import MXNet
  from sagemaker.predictor import Predictor
  from sagemaker.serializers import NumpySerializer
  from sagemaker.utils import sagemaker_timestamp, unique_name_from_base
  from tests.integ import DATA_DIR, TRAINING_DEFAULT_TIMEOUT_MINUTES
  from tests.integ.retry import retries
  from tests.integ.timeout import timeout, timeout_and_delete_endpoint_by_name
label_desc: Use image node_id 9 for calling a global function with example usage: test_multi_data_model_deploy_train_model_from_amazon_first_party_estimator(container_image, sagemaker_session, cpu_instance_type) without return types