tfx.types.ComponentSpec

View source on GitHub

Class ComponentSpec

A specification of the inputs, outputs and parameters for a component.

Aliases:

Components should have a corresponding ComponentSpec inheriting from this class and must override:

  • PARAMETERS (as a dict of string keys and ExecutionParameter values),
  • INPUTS (as a dict of string keys and ChannelParameter values) and
  • OUTPUTS (also a dict of string keys and ChannelParameter values).

Here is an example of how a ComponentSpec may be defined:

class MyCustomComponentSpec(ComponentSpec): PARAMETERS = { 'internal_option': ExecutionParameter(type=str), } INPUTS = { 'input_examples': ChannelParameter(type=standard_artifacts.Examples), } OUTPUTS = { 'output_examples': ChannelParameter(type=standard_artifacts.Examples), }

To create an instance of a subclass, call it directly with any execution parameters / inputs / outputs as kwargs. For example:

spec = MyCustomComponentSpec( internal_option='abc', input_examples=input_examples_channel, output_examples=output_examples_channel)

Attributes:

  • PARAMETERS: a dict of string keys and ExecutionParameter values.
  • INPUTS: a dict of string keys and ChannelParameter values.
  • OUTPUTS: a dict of string keys and ChannelParameter values.

__init__

View source

__init__(**kwargs)

Initialize a ComponentSpec.

Args:

  • **kwargs: Any inputs, outputs and execution parameters for this instance of the component spec.

Methods

INPUTS

View source

INPUTS()

OUTPUTS

View source

OUTPUTS()

PARAMETERS

View source

PARAMETERS()