class_docstr: Creates a Transformer step collection for workflow.
docstr: Construct steps required for a Transformer step collection:
  
  An estimator-centric step collection. It models what happens in workflows
  when invoking the `transform()` method on an estimator instance:
  First, if custom
  model artifacts are required, a `_RepackModelStep` is included.
  Second, a
  `CreateModelStep` with the model data passed in from a training step or other
  training job output.
  Finally, a `TransformerStep`.
  
  If repacking
  the model artifacts is not necessary, only the CreateModelStep and TransformerStep
  are in the step collection.
  
  Args:
      name (str): The name of the Transform Step.
      estimator: The estimator instance.
      instance_count (int): The number of EC2 instances to use.
      instance_type (str): The type of EC2 instance to use.
      strategy (str): The strategy used to decide how to batch records in
          a single request (default: None). Valid values: 'MultiRecord'
          and 'SingleRecord'.
      assemble_with (str): How the output is assembled (default: None).
          Valid values: 'Line' or 'None'.
      output_path (str): The S3 location for saving the transform result. If
          not specified, results are stored to a default bucket.
      output_kms_key (str): Optional. A KMS key ID for encrypting the
          transform output (default: None).
      accept (str): The accept header passed by the client to
          the inference endpoint. If it is supported by the endpoint,
          it will be the format of the batch transform output.
      env (dict): The Environment variables to be set for use during the
          transform job (default: None).
      depends_on (List[Union[str, Step, StepCollection]]): The list of `Step`/`StepCollection`
          names or `Step` instances or `StepCollection` instances that the first step
          in the collection depends on (default: None).
      repack_model_step_retry_policies (List[RetryPolicy]): The list of retry policies
          for the repack model step
      model_step_retry_policies (List[RetryPolicy]): The list of retry policies for
          model step
      transform_step_retry_policies (List[RetryPolicy]): The list of retry policies for
          transform step
docstr_tok: ["Construct","steps","required","for","a","Transformer","step","collection",":","An","estimator-centric","step","collection",".","It","models","what","happens","in","workflows","when","invoking","the","`","transform","(",")","`","method","on","an","estimator","instance",":","First",",","if","custom","model","artifacts","are","required",",","a","`","_RepackModelStep","`","is","included",".","Second",",","a","`","CreateModelStep","`","with","the","model","data","passed","in","from","a","training","step","or","other","training","job","output",".","Finally",",","a","`","TransformerStep","`",".","If","repacking","the","model","artifacts","is","not","necessary",",","only","the","CreateModelStep","and","TransformerStep","are","in","the","step","collection",".","Args",":","name","(","str",")",":","The","name","of","the","Transform","Step",".","estimator",":","The","estimator","instance",".","instance_count","(","int",")",":","The","number","of","EC2","instances","to","use",".","instance_type","(","str",")",":","The","type","of","EC2","instance","to","use",".","strategy","(","str",")",":","The","strategy","used","to","decide","how","to","batch","records","in","a","single","request","(","default",":","None",")",".","Valid","values",":","'MultiRecord'","and","'SingleRecord","'",".","assemble_with","(","str",")",":","How","the","output","is","assembled","(","default",":","None",")",".","Valid","values",":","'Line","'","or","'None","'",".","output_path","(","str",")",":","The","S3","location","for","saving","the","transform","result",".","If","not","specified",",","results","are","stored","to","a","default","bucket",".","output_kms_key","(","str",")",":","Optional",".","A","KMS","key","ID","for","encrypting","the","transform","output","(","default",":","None",")",".","accept","(","str",")",":","The","accept","header","passed","by","the","client","to","the","inference","endpoint",".","If","it","is","supported","by","the","endpoint",",","it","will","be","the","format","of","the","batch","transform","output",".","env","(","dict",")",":","The","Environment","variables","to","be","set","for","use","during","the","transform","job","(","default",":","None",")",".","depends_on","(","List","[","Union","[","str",",","Step",",","StepCollection","]","]",")",":","The","list","of","`","Step","`","\/","`","StepCollection","`","names","or","`","Step","`","instances","or","`","StepCollection","`","instances","that","the","first","step","in","the","collection","depends","on","(","default",":","None",")",".","repack_model_step_retry_policies","(","List","[","RetryPolicy","]",")",":","The","list","of","retry","policies","for","the","repack","model","step","model_step_retry_policies","(","List","[","RetryPolicy","]",")",":","The","list","of","retry","policies","for","model","step","transform_step_retry_policies","(","List","[","RetryPolicy","]",")",":","The","list","of","retry","policies","for","transform","step"]
code: def __init__(
      self,
      name: str,
      estimator: EstimatorBase,
      model_data,
      model_inputs,
      instance_count,
      instance_type,
      transform_inputs,
      description: str = None,
      display_name: str = None,
      # model arguments
      image_uri=None,
      predictor_cls=None,
      env=None,
      # transformer arguments
      strategy=None,
      assemble_with=None,
      output_path=None,
      output_kms_key=None,
      accept=None,
      max_concurrent_transforms=None,
      max_payload=None,
      tags=None,
      volume_kms_key=None,
      depends_on: Optional[
          List[Union[str, Step, StepCollection]]
      ] = None,
      # step retry policies
      repack_model_step_retry_policies: List[RetryPolicy] = None,
      model_step_retry_policies: List[RetryPolicy] = None,
      transform_step_retry_policies: List[RetryPolicy] = None,
      **kwargs,
  ):
      """Construct steps required for a Transformer step collection:
  
      An estimator-centric step collection. It models what happens in workflows
      when invoking the `transform()` method on an estimator instance:
      First, if custom
      model artifacts are required, a `_RepackModelStep` is included.
      Second, a
      `CreateModelStep` with the model data passed in from a training step or other
      training job output.
      Finally, a `TransformerStep`.
  
      If repacking
      the model artifacts is not necessary, only the CreateModelStep and TransformerStep
      are in the step collection.
  
      Args:
          name (str): The name of the Transform Step.
          estimator: The estimator instance.
          instance_count (int): The number of EC2 instances to use.
          instance_type (str): The type of EC2 instance to use.
          strategy (str): The strategy used to decide how to batch records in
              a single request (default: None). Valid values: 'MultiRecord'
              and 'SingleRecord'.
          assemble_with (str): How the output is assembled (default: None).
              Valid values: 'Line' or 'None'.
          output_path (str): The S3 location for saving the transform result. If
              not specified, results are stored to a default bucket.
          output_kms_key (str): Optional. A KMS key ID for encrypting the
              transform output (default: None).
          accept (str): The accept header passed by the client to
              the inference endpoint. If it is supported by the endpoint,
              it will be the format of the batch transform output.
          env (dict): The Environment variables to be set for use during the
              transform job (default: None).
          depends_on (List[Union[str, Step, StepCollection]]): The list of `Step`/`StepCollection`
              names or `Step` instances or `StepCollection` instances that the first step
              in the collection depends on (default: None).
          repack_model_step_retry_policies (List[RetryPolicy]): The list of retry policies
              for the repack model step
          model_step_retry_policies (List[RetryPolicy]): The list of retry policies for
              model step
          transform_step_retry_policies (List[RetryPolicy]): The list of retry policies for
              transform step
      """
      super().__init__(name=name, depends_on=depends_on)
      steps = []
      tags = format_tags(tags)
      if "entry_point" in kwargs:
          entry_point = kwargs.get("entry_point", None)
          source_dir = kwargs.get("source_dir", None)
          dependencies = kwargs.get("dependencies", None)
          repack_model_step = _RepackModelStep(
              name=f"{name}RepackModel",
              depends_on=depends_on,
              retry_policies=repack_model_step_retry_policies,
              sagemaker_session=estimator.sagemaker_session,
              role=estimator.role,
              model_data=model_data,
              entry_point=entry_point,
              source_dir=source_dir,
              dependencies=dependencies,
              tags=tags,
              subnets=estimator.subnets,
              security_group_ids=estimator.security_group_ids,
              description=description,
              display_name=display_name,
              output_kms_key=estimator.output_kms_key,
          )
          steps.append(repack_model_step)
          model_data = (
              repack_model_step.properties.ModelArtifacts.S3ModelArtifacts
          )
  
      def predict_wrapper(endpoint, session):
          return Predictor(endpoint, session)
  
      predictor_cls = predictor_cls or predict_wrapper
  
      model = Model(
          image_uri=image_uri or estimator.training_image_uri(),
          model_data=model_data,
          predictor_cls=predictor_cls,
          vpc_config=None,
          sagemaker_session=estimator.sagemaker_session,
          role=estimator.role,
          env=kwargs.get("env", None),
          name=kwargs.get("name", None),
          enable_network_isolation=kwargs.get(
              "enable_network_isolation", None
          ),
          model_kms_key=kwargs.get("model_kms_key", None),
          image_config=kwargs.get("image_config", None),
      )
      model_step = CreateModelStep(
          name=f"{name}CreateModelStep",
          model=model,
          inputs=model_inputs,
          description=description,
          display_name=display_name,
          retry_policies=model_step_retry_policies,
      )
      if "entry_point" not in kwargs and depends_on:
          # if the CreateModelStep is the first step in the collection
          model_step.add_depends_on(depends_on)
      steps.append(model_step)
  
      transformer = Transformer(
          model_name=model_step.properties.ModelName,
          instance_count=instance_count,
          instance_type=instance_type,
          strategy=strategy,
          assemble_with=assemble_with,
          output_path=output_path,
          output_kms_key=output_kms_key,
          accept=accept,
          max_concurrent_transforms=max_concurrent_transforms,
          max_payload=max_payload,
          env=env,
          tags=tags,
          base_transform_job_name=name,
          volume_kms_key=volume_kms_key,
          sagemaker_session=estimator.sagemaker_session,
      )
      transform_step = TransformStep(
          name=f"{name}TransformStep",
          transformer=transformer,
          inputs=transform_inputs,
          description=description,
          display_name=display_name,
          retry_policies=transform_step_retry_policies,
      )
      steps.append(transform_step)
  
      self.steps = steps
  
imports: from __future__ import absolute_import
  import warnings
  from typing import List, Union, Optional
  import attr
  from sagemaker.estimator import EstimatorBase
  from sagemaker.model import Model
  from sagemaker import PipelineModel
  from sagemaker.predictor import Predictor
  from sagemaker.transformer import Transformer
  from sagemaker.workflow.entities import RequestType
  from sagemaker.workflow.step_outputs import StepOutput
  from sagemaker.workflow.steps import Step, CreateModelStep, TransformStep
  from sagemaker.workflow._utils import _RegisterModelStep, _RepackModelStep
  from sagemaker.workflow.retry import RetryPolicy
  from sagemaker.utils import update_container_with_inference_params, format_tags
label_desc: Use image node_id 1 to create a new EstimatorTransformer object from inherited base classes: StepCollection with example: obj = EstimatorTransformer(name, estimator, model_data, model_inputs, instance_count, instance_type, transform_inputs, description, display_name, image_uri, predictor_cls, env, strategy, assemble_with, output_path, output_kms_key, accept, max_concurrent_transforms, max_payload, tags, volume_kms_key, depends_on, repack_model_step_retry_policies, model_step_retry_policies, transform_step_retry_policies)