class_docstr: A pipeline of SageMaker `Model` instances.
  
  This pipeline can be deployed as an `Endpoint` on SageMaker.
docstr: Deploy the ``Model`` to an ``Endpoint``.
  
  It optionally return a ``Predictor``.
  
  Create a SageMaker ``Model`` and ``EndpointConfig``, and deploy an
  ``Endpoint`` from this ``Model``. If ``self.predictor_cls`` is not None,
  this method returns a the result of invoking ``self.predictor_cls`` on
  the created endpoint name.
  
  The name of the created model is accessible in the ``name`` field of
  this ``Model`` after deploy returns
  
  The name of the created endpoint is accessible in the
  ``endpoint_name`` field of this ``Model`` after deploy returns.
  
  Args:
      initial_instance_count (int): The initial number of instances to run
          in the ``Endpoint`` created from this ``Model``.
      instance_type (str): The EC2 instance type to deploy this Model to.
          For example, 'ml.p2.xlarge'.
      serializer (:class:`~sagemaker.serializers.BaseSerializer`): A
          serializer object, used to encode data for an inference endpoint
          (default: None). If ``serializer`` is not None, then
          ``serializer`` will override the default serializer. The
          default serializer is set by the ``predictor_cls``.
      deserializer (:class:`~sagemaker.deserializers.BaseDeserializer`): A
          deserializer object, used to decode data from an inference
          endpoint (default: None). If ``deserializer`` is not None, then
          ``deserializer`` will override the default deserializer. The
          default deserializer is set by the ``predictor_cls``.
      endpoint_name (str): The name of the endpoint to create (default:
          None). If not specified, a unique endpoint name will be created.
      tags (List[dict[str, str]]): The list of tags to attach to this
          specific endpoint.
      wait (bool): Whether the call should wait until the deployment of
          model completes (default: True).
      update_endpoint (bool): Flag to update the model in an existing
          Amazon SageMaker endpoint. If True, this will deploy a new
          EndpointConfig to an already existing endpoint and delete
          resources corresponding to the previous EndpointConfig. If
          False, a new endpoint will be created. Default: False
      data_capture_config (sagemaker.model_monitor.DataCaptureConfig): Specifies
          configuration related to Endpoint data capture for use with
          Amazon SageMaker Model Monitoring. Default: None.
      kms_key (str): The ARN, Key ID or Alias of the KMS key that is used to
          encrypt the data on the storage volume attached to the instance hosting
          the endpoint.
      volume_size (int): The size, in GB, of the ML storage volume attached to individual
          inference instance associated with the production variant. Currenly only Amazon EBS
          gp2 storage volumes are supported.
      model_data_download_timeout (int): The timeout value, in seconds, to download and
          extract model data from Amazon S3 to the individual inference instance associated
          with this production variant.
      container_startup_health_check_timeout (int): The timeout value, in seconds, for your
          inference container to pass health check by SageMaker Hosting. For more information
          about health check see:
          https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html#your-algorithms-inference-algo-ping-requests
  
  Returns:
      callable[string, sagemaker.session.Session] or None: Invocation of
      ``self.predictor_cls`` on the created endpoint name, if ``self.predictor_cls``
      is not None. Otherwise, return None.
docstr_tok: ["Deploy","the","``","Model","``","to","an","``","Endpoint","``",".","It","optionally","return","a","``","Predictor","``",".","Create","a","SageMaker","``","Model","``","and","``","EndpointConfig","``",",","and","deploy","an","``","Endpoint","``","from","this","``","Model","``",".","If","``","self.predictor_cls","``","is","not","None",",","this","method","returns","a","the","result","of","invoking","``","self.predictor_cls","``","on","the","created","endpoint","name",".","The","name","of","the","created","model","is","accessible","in","the","``","name","``","field","of","this","``","Model","``","after","deploy","returns","The","name","of","the","created","endpoint","is","accessible","in","the","``","endpoint_name","``","field","of","this","``","Model","``","after","deploy","returns",".","Args",":","initial_instance_count","(","int",")",":","The","initial","number","of","instances","to","run","in","the","``","Endpoint","``","created","from","this","``","Model","``",".","instance_type","(","str",")",":","The","EC2","instance","type","to","deploy","this","Model","to",".","For","example",",","'ml.p2.xlarge","'",".","serializer","(",":","class",":","`","~sagemaker.serializers.BaseSerializer","`",")",":","A","serializer","object",",","used","to","encode","data","for","an","inference","endpoint","(","default",":","None",")",".","If","``","serializer","``","is","not","None",",","then","``","serializer","``","will","override","the","default","serializer",".","The","default","serializer","is","set","by","the","``","predictor_cls","``",".","deserializer","(",":","class",":","`","~sagemaker.deserializers.BaseDeserializer","`",")",":","A","deserializer","object",",","used","to","decode","data","from","an","inference","endpoint","(","default",":","None",")",".","If","``","deserializer","``","is","not","None",",","then","``","deserializer","``","will","override","the","default","deserializer",".","The","default","deserializer","is","set","by","the","``","predictor_cls","``",".","endpoint_name","(","str",")",":","The","name","of","the","endpoint","to","create","(","default",":","None",")",".","If","not","specified",",","a","unique","endpoint","name","will","be","created",".","tags","(","List","[","dict","[","str",",","str","]","]",")",":","The","list","of","tags","to","attach","to","this","specific","endpoint",".","wait","(","bool",")",":","Whether","the","call","should","wait","until","the","deployment","of","model","completes","(","default",":","True",")",".","update_endpoint","(","bool",")",":","Flag","to","update","the","model","in","an","existing","Amazon","SageMaker","endpoint",".","If","True",",","this","will","deploy","a","new","EndpointConfig","to","an","already","existing","endpoint","and","delete","resources","corresponding","to","the","previous","EndpointConfig",".","If","False",",","a","new","endpoint","will","be","created",".","Default",":","False","data_capture_config","(","sagemaker.model_monitor.DataCaptureConfig",")",":","Specifies","configuration","related","to","Endpoint","data","capture","for","use","with","Amazon","SageMaker","Model","Monitoring",".","Default",":","None",".","kms_key","(","str",")",":","The","ARN",",","Key","ID","or","Alias","of","the","KMS","key","that","is","used","to","encrypt","the","data","on","the","storage","volume","attached","to","the","instance","hosting","the","endpoint",".","volume_size","(","int",")",":","The","size",",","in","GB",",","of","the","ML","storage","volume","attached","to","individual","inference","instance","associated","with","the","production","variant",".","Currenly","only","Amazon","EBS","gp2","storage","volumes","are","supported",".","model_data_download_timeout","(","int",")",":","The","timeout","value",",","in","seconds",",","to","download","and","extract","model","data","from","Amazon","S3","to","the","individual","inference","instance","associated","with","this","production","variant",".","container_startup_health_check_timeout","(","int",")",":","The","timeout","value",",","in","seconds",",","for","your","inference","container","to","pass","health","check","by","SageMaker","Hosting",".","For","more","information","about","health","check","see",":","https",":","\/\/docs.aws.amazon.com\/sagemaker\/latest\/dg\/your-algorithms-inference-code.html","#","your-algorithms-inference-algo-ping-requests","Returns",":","callable","[","string",",","sagemaker.session.Session","]","or","None",":","Invocation","of","``","self.predictor_cls","``","on","the","created","endpoint","name",",","if","``","self.predictor_cls","``","is","not","None",".","Otherwise",",","return","None","."]
code: def deploy(
      self,
      initial_instance_count,
      instance_type,
      serializer=None,
      deserializer=None,
      endpoint_name=None,
      tags=None,
      wait=True,
      update_endpoint=False,
      data_capture_config=None,
      kms_key=None,
      volume_size=None,
      model_data_download_timeout=None,
      container_startup_health_check_timeout=None,
  ):
      """Deploy the ``Model`` to an ``Endpoint``.
  
      It optionally return a ``Predictor``.
  
      Create a SageMaker ``Model`` and ``EndpointConfig``, and deploy an
      ``Endpoint`` from this ``Model``. If ``self.predictor_cls`` is not None,
      this method returns a the result of invoking ``self.predictor_cls`` on
      the created endpoint name.
  
      The name of the created model is accessible in the ``name`` field of
      this ``Model`` after deploy returns
  
      The name of the created endpoint is accessible in the
      ``endpoint_name`` field of this ``Model`` after deploy returns.
  
      Args:
          initial_instance_count (int): The initial number of instances to run
              in the ``Endpoint`` created from this ``Model``.
          instance_type (str): The EC2 instance type to deploy this Model to.
              For example, 'ml.p2.xlarge'.
          serializer (:class:`~sagemaker.serializers.BaseSerializer`): A
              serializer object, used to encode data for an inference endpoint
              (default: None). If ``serializer`` is not None, then
              ``serializer`` will override the default serializer. The
              default serializer is set by the ``predictor_cls``.
          deserializer (:class:`~sagemaker.deserializers.BaseDeserializer`): A
              deserializer object, used to decode data from an inference
              endpoint (default: None). If ``deserializer`` is not None, then
              ``deserializer`` will override the default deserializer. The
              default deserializer is set by the ``predictor_cls``.
          endpoint_name (str): The name of the endpoint to create (default:
              None). If not specified, a unique endpoint name will be created.
          tags (List[dict[str, str]]): The list of tags to attach to this
              specific endpoint.
          wait (bool): Whether the call should wait until the deployment of
              model completes (default: True).
          update_endpoint (bool): Flag to update the model in an existing
              Amazon SageMaker endpoint. If True, this will deploy a new
              EndpointConfig to an already existing endpoint and delete
              resources corresponding to the previous EndpointConfig. If
              False, a new endpoint will be created. Default: False
          data_capture_config (sagemaker.model_monitor.DataCaptureConfig): Specifies
              configuration related to Endpoint data capture for use with
              Amazon SageMaker Model Monitoring. Default: None.
          kms_key (str): The ARN, Key ID or Alias of the KMS key that is used to
              encrypt the data on the storage volume attached to the instance hosting
              the endpoint.
          volume_size (int): The size, in GB, of the ML storage volume attached to individual
              inference instance associated with the production variant. Currenly only Amazon EBS
              gp2 storage volumes are supported.
          model_data_download_timeout (int): The timeout value, in seconds, to download and
              extract model data from Amazon S3 to the individual inference instance associated
              with this production variant.
          container_startup_health_check_timeout (int): The timeout value, in seconds, for your
              inference container to pass health check by SageMaker Hosting. For more information
              about health check see:
              https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html#your-algorithms-inference-algo-ping-requests
  
      Returns:
          callable[string, sagemaker.session.Session] or None: Invocation of
          ``self.predictor_cls`` on the created endpoint name, if ``self.predictor_cls``
          is not None. Otherwise, return None.
      """
      if not self.sagemaker_session:
          self.sagemaker_session = Session(
              sagemaker_config=self._sagemaker_config
          )
  
      containers = self.pipeline_container_def(instance_type)
  
      self.name = self.name or name_from_image(containers[0]["Image"])
      self.sagemaker_session.create_model(
          self.name,
          self.role,
          containers,
          vpc_config=self.vpc_config,
          enable_network_isolation=self.enable_network_isolation,
      )
  
      production_variant = sagemaker.production_variant(
          self.name,
          instance_type,
          initial_instance_count,
          volume_size=volume_size,
          model_data_download_timeout=model_data_download_timeout,
          container_startup_health_check_timeout=container_startup_health_check_timeout,
      )
      self.endpoint_name = endpoint_name or self.name
      kms_key = (
          resolve_value_from_config(
              kms_key,
              ENDPOINT_CONFIG_KMS_KEY_ID_PATH,
              sagemaker_session=self.sagemaker_session,
          )
          if instance_supports_kms(instance_type)
          else kms_key
      )
  
      data_capture_config_dict = None
      if data_capture_config is not None:
          data_capture_config_dict = (
              data_capture_config._to_request_dict()
          )
  
      tags = format_tags(tags)
  
      if update_endpoint:
          endpoint_config_name = self.sagemaker_session.create_endpoint_config(
              name=self.name,
              model_name=self.name,
              initial_instance_count=initial_instance_count,
              instance_type=instance_type,
              tags=tags,
              kms_key=kms_key,
              data_capture_config_dict=data_capture_config_dict,
              volume_size=volume_size,
              model_data_download_timeout=model_data_download_timeout,
              container_startup_health_check_timeout=container_startup_health_check_timeout,
          )
          self.sagemaker_session.update_endpoint(
              self.endpoint_name, endpoint_config_name, wait=wait
          )
      else:
          self.sagemaker_session.endpoint_from_production_variants(
              name=self.endpoint_name,
              production_variants=[production_variant],
              tags=tags,
              kms_key=kms_key,
              wait=wait,
              data_capture_config_dict=data_capture_config_dict,
          )
  
      if self.predictor_cls:
          predictor = self.predictor_cls(
              self.endpoint_name, self.sagemaker_session
          )
          if serializer:
              predictor.serializer = serializer
          if deserializer:
              predictor.deserializer = deserializer
          return predictor
      return None
  
imports: from __future__ import absolute_import
  from typing import Optional, Dict, List, Union
  import sagemaker
  from sagemaker import ModelMetrics, Model
  from sagemaker.config import ENDPOINT_CONFIG_KMS_KEY_ID_PATH, MODEL_VPC_CONFIG_PATH, MODEL_ENABLE_NETWORK_ISOLATION_PATH, MODEL_EXECUTION_ROLE_ARN_PATH, load_sagemaker_config
  from sagemaker.drift_check_baselines import DriftCheckBaselines
  from sagemaker.metadata_properties import MetadataProperties
  from sagemaker.session import Session
  from sagemaker.utils import name_from_image, update_container_with_inference_params, resolve_value_from_config, format_tags
  from sagemaker.transformer import Transformer
  from sagemaker.workflow.entities import PipelineVariable
  from sagemaker.workflow.pipeline_context import runnable_by_pipeline
  from sagemaker.utils import instance_supports_kms
label_desc: Use image node_id 3 for calling the PipelineModel obj's underlying member method code with example usage: obj.deploy(initial_instance_count, instance_type, serializer, deserializer, endpoint_name, tags, wait, update_endpoint, data_capture_config, kms_key, volume_size, model_data_download_timeout, container_startup_health_check_timeout) and returns: None, predictor