tfx.types.ComponentSpec

View source on GitHub

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

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)

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

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.

Methods

INPUTS

View source

OUTPUTS

View source

PARAMETERS

View source

from_json_dict

View source

Convert from dictionary data to an object.

to_json_dict

View source

Convert from an object to a JSON serializable dictionary.

__eq__

View source

Return self==value.