class_docstr: A TFX component to push validated TensorFlow models to a model serving platform.
  
  The `Pusher` component can be used to push an validated SavedModel from output
  of the [Trainer component](https://www.tensorflow.org/tfx/guide/trainer) to
  [TensorFlow Serving](https://www.tensorflow.org/tfx/serving).  The Pusher
  will check the validation results from the [Evaluator
  component](https://www.tensorflow.org/tfx/guide/evaluator) and [InfraValidator
  component](https://www.tensorflow.org/tfx/guide/infra_validator)
  before deploying the model.  If the model has not been blessed, then the model
  will not be pushed.
  
  *Note:* The executor for this component can be overriden to enable the model
  to be pushed to other serving platforms than tf.serving.  The [Cloud AI
  Platform custom
  executor](https://github.com/tensorflow/tfx/tree/master/tfx/extensions/google_cloud_ai_platform/pusher)
  provides an example how to implement this.
  
  ## Example
  ```
    # Checks whether the model passed the validation steps and pushes the model
    # to a file destination if check passed.
    pusher = Pusher(
        model=trainer.outputs['model'],
        model_blessing=evaluator.outputs['blessing'],
        push_destination=proto.PushDestination(
            filesystem=proto.PushDestination.Filesystem(
                base_directory=serving_model_dir)))
  ```
  
  Component `outputs` contains:
   - `pushed_model`: Channel of type `standard_artifacts.PushedModel` with
                     result of push.
  
  See [the Pusher guide](https://www.tensorflow.org/tfx/guide/pusher) for more
  details.
class_docstr_tok: ["A","TFX","component","to","push","validated","TensorFlow","models","to","a","model","serving","platform",".","The","`","Pusher","`","component","can","be","used","to","push","an","validated","SavedModel","from","output","of","the","[","Trainer","component","]","(","https",":","\/\/www.tensorflow.org\/tfx\/guide\/trainer",")","to","[","TensorFlow","Serving","]","(","https",":","\/\/www.tensorflow.org\/tfx\/serving",")",".","The","Pusher","will","check","the","validation","results","from","the","[","Evaluator","component","]","(","https",":","\/\/www.tensorflow.org\/tfx\/guide\/evaluator",")","and","[","InfraValidator","component","]","(","https",":","\/\/www.tensorflow.org\/tfx\/guide\/infra_validator",")","before","deploying","the","model",".","If","the","model","has","not","been","blessed",",","then","the","model","will","not","be","pushed",".","*","Note",":","*","The","executor","for","this","component","can","be","overriden","to","enable","the","model","to","be","pushed","to","other","serving","platforms","than","tf.serving",".","The","[","Cloud","AI","Platform","custom","executor","]","(","https",":","\/\/github.com\/tensorflow\/tfx\/tree\/master\/tfx\/extensions\/google_cloud_ai_platform\/pusher",")","provides","an","example","how","to","implement","this",".","#","#","Example","``","`","#","Checks","whether","the","model","passed","the","validation","steps","and","pushes","the","model","#","to","a","file","destination","if","check","passed",".","pusher","=","Pusher","(","model=trainer.outputs","[","'model","'","]",",","model_blessing=evaluator.outputs","[","'blessing","'","]",",","push_destination=proto.PushDestination","(","filesystem=proto.PushDestination.Filesystem","(","base_directory=serving_model_dir",")",")",")","``","`","Component","`","outputs","`","contains",":","-","`","pushed_model","`",":","Channel","of","type","`","standard_artifacts.PushedModel","`","with","result","of","push",".","See","[","the","Pusher","guide","]","(","https",":","\/\/www.tensorflow.org\/tfx\/guide\/pusher",")","for","more","details","."]
docstr: Construct a Pusher component.
  
  Args:
    model: An optional BaseChannel of type `standard_artifacts.Model`, usually
      produced by a Trainer component.
    model_blessing: An optional BaseChannel of type
      `standard_artifacts.ModelBlessing`, usually produced from an Evaluator
      component.
    infra_blessing: An optional BaseChannel of type
      `standard_artifacts.InfraBlessing`, usually produced from an
      InfraValidator component.
    push_destination: A pusher_pb2.PushDestination instance, providing info
      for tensorflow serving to load models. Optional if executor_class
      doesn't require push_destination.
    custom_config: A dict which contains the deployment job parameters to be
      passed to Cloud platforms.
    custom_executor_spec: Optional custom executor spec. Deprecated (no
      compatibility guarantee), please customize component directly.
docstr_tok: ["Construct","a","Pusher","component",".","Args",":","model",":","An","optional","BaseChannel","of","type","`","standard_artifacts.Model","`",",","usually","produced","by","a","Trainer","component",".","model_blessing",":","An","optional","BaseChannel","of","type","`","standard_artifacts.ModelBlessing","`",",","usually","produced","from","an","Evaluator","component",".","infra_blessing",":","An","optional","BaseChannel","of","type","`","standard_artifacts.InfraBlessing","`",",","usually","produced","from","an","InfraValidator","component",".","push_destination",":","A","pusher_pb2.PushDestination","instance",",","providing","info","for","tensorflow","serving","to","load","models",".","Optional","if","executor_class","does","n't","require","push_destination",".","custom_config",":","A","dict","which","contains","the","deployment","job","parameters","to","be","passed","to","Cloud","platforms",".","custom_executor_spec",":","Optional","custom","executor","spec",".","Deprecated","(","no","compatibility","guarantee",")",",","please","customize","component","directly","."]
code: def __init__(
      self,
      model: Optional[types.BaseChannel] = None,
      model_blessing: Optional[types.BaseChannel] = None,
      infra_blessing: Optional[types.BaseChannel] = None,
      push_destination: Optional[
          Union[pusher_pb2.PushDestination, data_types.RuntimeParameter]
      ] = None,
      custom_config: Optional[Dict[str, Any]] = None,
      custom_executor_spec: Optional[executor_spec.ExecutorSpec] = None,
  ):
      """Construct a Pusher component.
  
      Args:
        model: An optional BaseChannel of type `standard_artifacts.Model`, usually
          produced by a Trainer component.
        model_blessing: An optional BaseChannel of type
          `standard_artifacts.ModelBlessing`, usually produced from an Evaluator
          component.
        infra_blessing: An optional BaseChannel of type
          `standard_artifacts.InfraBlessing`, usually produced from an
          InfraValidator component.
        push_destination: A pusher_pb2.PushDestination instance, providing info
          for tensorflow serving to load models. Optional if executor_class
          doesn't require push_destination.
        custom_config: A dict which contains the deployment job parameters to be
          passed to Cloud platforms.
        custom_executor_spec: Optional custom executor spec. Deprecated (no
          compatibility guarantee), please customize component directly.
      """
      pushed_model = types.Channel(type=standard_artifacts.PushedModel)
      if (
          push_destination is None
          and not custom_executor_spec
          and self.EXECUTOR_SPEC.executor_class == executor.Executor
      ):
          raise ValueError(
              "push_destination is required unless a "
              "custom_executor_spec is supplied that does not require "
              "it."
          )
      if custom_executor_spec:
          logging.warning(
              "`custom_executor_spec` is deprecated. Please customize component directly."
          )
      if model is None and infra_blessing is None:
          raise ValueError(
              "Either one of model or infra_blessing channel should be given. "
              "If infra_blessing is used in place of model, it must have been "
              "created with InfraValidator with RequestSpec.make_warmup = True. "
              "This cannot be checked during pipeline construction time but will "
              "raise runtime error if infra_blessing does not contain a model."
          )
      spec = standard_component_specs.PusherSpec(
          model=model,
          model_blessing=model_blessing,
          infra_blessing=infra_blessing,
          push_destination=push_destination,
          custom_config=json_utils.dumps(custom_config),
          pushed_model=pushed_model,
      )
      super().__init__(
          spec=spec, custom_executor_spec=custom_executor_spec
      )
  
file_path: tfx/tfx/components/pusher/component.py
imports: from typing import Any, Dict, Optional, Union
  from absl import logging
  from tfx import types
  from tfx.components.pusher import executor
  from tfx.dsl.components.base import base_component
  from tfx.dsl.components.base import executor_spec
  from tfx.orchestration import data_types
  from tfx.proto import pusher_pb2
  from tfx.types import standard_artifacts
  from tfx.types import standard_component_specs
  from tfx.utils import json_utils
label_desc: Use image node_id 1 to create a new Pusher object from inherited base classes: base_component with example: obj = Pusher(model, model_blessing, infra_blessing, push_destination, custom_config, custom_executor_spec)