Stay organized with collections Save and categorize content based on your preferences.

Creates an exit handler from a typehint-annotated Python function.

This decorator creates an exit handler wrapping the component typehint annotation - typehint annotations specified for the arguments and return value for a Python function. Exit handler is to annotate the component for post actions of a pipeline, only supported in Vertex AI. Specifically, function arguments can be annotated with the following types and associated semantics supported in component. In order to get in the final status of dependent pipeline, parameter should be defined as Parameter[str], passing in FinalStatusStr type when initializing the component.

This is example usage of component definition using this decorator:

  from tfx import v1 as tfx

  def MyExitHandlerComponent(final_status: tfx.dsl.components.Parameter[str]):
    # parse the final status
    pipeline_task_status = pipeline_pb2.PipelineTaskFinalStatus()
    proto_utils.json_to_proto(final_status, pipeline_task_status)

Example usage in a Vertex AI graph definition:

  exit_handler = exit_handler_component(

  dsl_pipeline = tfx.dsl.Pipeline(...)

  runner = tfx.orchestration.experimental.KubeflowV2DagRunner(...)

func Typehint-annotated component executor function.

base_component.BaseComponent subclass for the given component executor function.