Parses the given component executor function.
tfx.dsl.component.experimental.function_parser.parse_typehint_component_function(
func: types.FunctionType
) -> Tuple[Dict[Text, Type[artifact.Artifact]], Dict[Text, Type[artifact.
Artifact]], Dict[Text, Type[Union[int, float, Text, bytes]]], Dict[Text,
Any], Dict[Text, ArgFormats], Set[Text]]
This method parses a typehinted-annotated Python function that is intended to
be used as a component and returns the information needed about the interface
(inputs / outputs / returned output values) about that components, as well as
a list of argument names and formats for determining the parameters that
should be passed when calling func(*args)
.
Args |
func
|
A component executor function to be parsed.
|
Returns |
inputs
|
A dictionary mapping each input name to its artifact type (as a
subclass of tfx.types.Artifact ).
|
outputs
|
A dictionary mapping each output name to its artifact type (as a
subclass of tfx.types.Artifact ).
|
parameters
|
A dictionary mapping each parameter name to its primitive type
(one of int , float , Text and bytes ).
|
arg_formats
|
Dictionary representing the input arguments of the given
component executor function. Each entry's key is the argument's string
name; each entry's value is the format of the argument to be passed into
the function (given by a value of the ArgFormats enum).
|
arg_defaults
|
Dictionary mapping names of optional arguments to default
values.
|
returned_outputs
|
A set of output names that are declared as ValueArtifact
returned outputs.
|