code: def test_inference_pipeline_model_deploy_and_update_endpoint(
      sagemaker_session,
      cpu_instance_type,
      alternative_cpu_instance_type,
  ):
      sparkml_data_path = os.path.join(DATA_DIR, "sparkml_model")
      xgboost_data_path = os.path.join(DATA_DIR, "xgboost_model")
      endpoint_name = unique_name_from_base(
          "test-inference-pipeline-deploy"
      )
      sparkml_model_data = sagemaker_session.upload_data(
          path=os.path.join(sparkml_data_path, "mleap_model.tar.gz"),
          key_prefix="integ-test-data/sparkml/model",
      )
      xgb_model_data = sagemaker_session.upload_data(
          path=os.path.join(xgboost_data_path, "xgb_model.tar.gz"),
          key_prefix="integ-test-data/xgboost/model",
      )
  
      with timeout_and_delete_endpoint_by_name(
          endpoint_name, sagemaker_session
      ):
          sparkml_model = SparkMLModel(
              model_data=sparkml_model_data,
              env={"SAGEMAKER_SPARKML_SCHEMA": SCHEMA},
              sagemaker_session=sagemaker_session,
          )
          xgb_image = image_uris.retrieve(
              "xgboost",
              sagemaker_session.boto_region_name,
              version="1",
              image_scope="inference",
          )
          xgb_model = Model(
              model_data=xgb_model_data,
              image_uri=xgb_image,
              sagemaker_session=sagemaker_session,
          )
          model = PipelineModel(
              models=[sparkml_model, xgb_model],
              role="SageMakerRole",
              predictor_cls=Predictor,
              sagemaker_session=sagemaker_session,
          )
          predictor = model.deploy(
              1,
              alternative_cpu_instance_type,
              endpoint_name=endpoint_name,
          )
          endpoint_desc = (
              sagemaker_session.sagemaker_client.describe_endpoint(
                  EndpointName=endpoint_name
              )
          )
          old_config_name = endpoint_desc["EndpointConfigName"]
  
          predictor.update_endpoint(
              initial_instance_count=1, instance_type=cpu_instance_type
          )
  
          endpoint_desc = (
              sagemaker_session.sagemaker_client.describe_endpoint(
                  EndpointName=endpoint_name
              )
          )
          new_config_name = endpoint_desc["EndpointConfigName"]
          new_config = sagemaker_session.sagemaker_client.describe_endpoint_config(
              EndpointConfigName=new_config_name
          )
  
          assert old_config_name != new_config_name
          assert (
              new_config["ProductionVariants"][0]["InstanceType"]
              == cpu_instance_type
          )
          assert (
              new_config["ProductionVariants"][0][
                  "InitialInstanceCount"
              ]
              == 1
          )
  
      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)
  
file_path: sagemaker-python-sdk/tests/integ/test_inference_pipeline.py
imports: from __future__ import absolute_import
  import json
  import os
  import pytest
  from tests.integ import DATA_DIR, TRANSFORM_DEFAULT_TIMEOUT_MINUTES
  from tests.integ.timeout import timeout_and_delete_endpoint_by_name, timeout_and_delete_model_with_transformer
  from sagemaker import image_uris
  from sagemaker.model import Model
  from sagemaker.pipeline import PipelineModel
  from sagemaker.predictor import Predictor
  from sagemaker.serializers import JSONSerializer
  from sagemaker.sparkml.model import SparkMLModel
  from sagemaker.utils import unique_name_from_base
label_desc: Use image node_id 3 for calling a global function with example usage: test_inference_pipeline_model_deploy_and_update_endpoint(sagemaker_session, cpu_instance_type, alternative_cpu_instance_type) without return types