kfp.components.structures package

class kfp.components.structures.AndPredicate(operands: kfp.components._structures.TwoBooleanOperands)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the “and” logical operation.

class kfp.components.structures.CachingStrategySpec(max_cache_staleness: Optional[str] = None)[source]

Bases: kfp.components.modelbase.ModelBase

class kfp.components.structures.ComponentReference(name: Optional[str] = None, digest: Optional[str] = None, tag: Optional[str] = None, url: Optional[str] = None, spec: Optional[kfp.components._structures.ComponentSpec] = None)[source]

Bases: kfp.components.modelbase.ModelBase

Component reference.

Contains information that can be used to locate and load a component by name, digest or URL

class kfp.components.structures.ComponentSpec(name: Optional[str] = None, description: Optional[str] = None, metadata: Optional[kfp.components._structures.MetadataSpec] = None, inputs: Optional[List[kfp.components._structures.InputSpec]] = None, outputs: Optional[List[kfp.components._structures.OutputSpec]] = None, implementation: Union[kfp.components._structures.ContainerImplementation, GraphImplementation, None] = None, version: Optional[str] = 'google.com/cloud/pipelines/component/v1')[source]

Bases: kfp.components.modelbase.ModelBase

Component specification.

Describes the metadata (name, description, annotations and labels), the interface (inputs and outputs) and the implementation of the component.

save(file_path: str)[source]

Saves the component definition to file.

It can be shared online and later loaded using the load_component function.

class kfp.components.structures.ConcatPlaceholder(items: List[Union[str, kfp.components._structures.InputValuePlaceholder, kfp.components._structures.InputPathPlaceholder, kfp.components._structures.OutputPathPlaceholder, kfp.components._structures.InputUriPlaceholder, kfp.components._structures.OutputUriPlaceholder, kfp.components._structures.InputMetadataPlaceholder, kfp.components._structures.InputOutputPortNamePlaceholder, kfp.components._structures.OutputMetadataPlaceholder, kfp.components._structures.ExecutorInputPlaceholder, ConcatPlaceholder, IfPlaceholder]])[source]

Bases: kfp.components.modelbase.ModelBase

Represents the command-line argument placeholder that will be replaced at run-time by the concatenated values of its items.

class kfp.components.structures.ContainerImplementation(container: kfp.components._structures.ContainerSpec)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the container component implementation.

class kfp.components.structures.ContainerSpec(image: str, command: Optional[List[Union[str, kfp.components._structures.InputValuePlaceholder, kfp.components._structures.InputPathPlaceholder, kfp.components._structures.OutputPathPlaceholder, kfp.components._structures.InputUriPlaceholder, kfp.components._structures.OutputUriPlaceholder, kfp.components._structures.InputMetadataPlaceholder, kfp.components._structures.InputOutputPortNamePlaceholder, kfp.components._structures.OutputMetadataPlaceholder, kfp.components._structures.ExecutorInputPlaceholder, ConcatPlaceholder, IfPlaceholder]]] = None, args: Optional[List[Union[str, kfp.components._structures.InputValuePlaceholder, kfp.components._structures.InputPathPlaceholder, kfp.components._structures.OutputPathPlaceholder, kfp.components._structures.InputUriPlaceholder, kfp.components._structures.OutputUriPlaceholder, kfp.components._structures.InputMetadataPlaceholder, kfp.components._structures.InputOutputPortNamePlaceholder, kfp.components._structures.OutputMetadataPlaceholder, kfp.components._structures.ExecutorInputPlaceholder, ConcatPlaceholder, IfPlaceholder]]] = None, env: Optional[Mapping[str, str]] = None, file_outputs: Optional[Mapping[str, str]] = None)[source]

Bases: kfp.components.modelbase.ModelBase

Describes the container component implementation.

class kfp.components.structures.EqualsPredicate(operands: kfp.components._structures.TwoOperands)[source]

Bases: kfp.components._structures.BinaryPredicate

Represents the “equals” comparison predicate.

class kfp.components.structures.ExecutionOptionsSpec(retry_strategy: Optional[kfp.components._structures.RetryStrategySpec] = None, caching_strategy: Optional[kfp.components._structures.CachingStrategySpec] = None)[source]

Bases: kfp.components.modelbase.ModelBase

class kfp.components.structures.ExecutorInputPlaceholder(executor_input: None = None)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the serialized ExecutorInput message at runtime.

This placeholder will be replaced by a serialized [ExecutorInput](https://github.com/kubeflow/pipelines/blob/61f9c2c328d245d89c9d9b8c923f24dbbd08cdc9/api/v2alpha1/pipeline_spec.proto#L730) proto message at runtime, which includes parameters of the task, artifact URIs and metadata.

to_dict() → Mapping[str, Any][source]
class kfp.components.structures.GraphImplementation(graph: kfp.components._structures.GraphSpec)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the graph component implementation.

class kfp.components.structures.GraphInputArgument(graph_input: kfp.components._structures.GraphInputReference)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the component argument value that comes from the graph component input.

class kfp.components.structures.GraphInputReference(input_name: str, type: Union[str, Dict[KT, VT], List[T], None] = None)[source]

Bases: kfp.components.modelbase.ModelBase

References the input of the graph (the scope is a single graph).

as_argument() → kfp.components._structures.GraphInputArgument[source]
with_type(type_spec: Union[str, Dict[KT, VT], List[T]]) → kfp.components._structures.GraphInputReference[source]
without_type() → kfp.components._structures.GraphInputReference[source]
class kfp.components.structures.GraphSpec(tasks: Mapping[str, kfp.components._structures.TaskSpec], output_values: Mapping[str, Union[str, int, float, bool, kfp.components._structures.GraphInputArgument, kfp.components._structures.TaskOutputArgument]] = None)[source]

Bases: kfp.components.modelbase.ModelBase

Describes the graph component implementation.

It represents a graph of component tasks connected to the upstream sources of data using the argument specifications. It also describes the sources of graph output values.

class kfp.components.structures.GreaterThanOrEqualPredicate(operands: kfp.components._structures.TwoOperands)[source]

Bases: kfp.components._structures.BinaryPredicate

Represents the “greater than or equal” comparison predicate.

class kfp.components.structures.GreaterThanPredicate(operands: kfp.components._structures.TwoOperands)[source]

Bases: kfp.components._structures.BinaryPredicate

Represents the “greater than” comparison predicate.

class kfp.components.structures.IfPlaceholder(if_structure: kfp.components._structures.IfPlaceholderStructure)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the command-line argument placeholder that will be replaced at run-time by the expanded value of either “then_value” or “else_value” depending on the submissio-time resolved value of the “cond” predicate.

class kfp.components.structures.IfPlaceholderStructure(condition: Union[bool, str, kfp.components._structures.IsPresentPlaceholder, kfp.components._structures.InputValuePlaceholder], then_value: Union[str, kfp.components._structures.InputValuePlaceholder, kfp.components._structures.InputPathPlaceholder, kfp.components._structures.OutputPathPlaceholder, kfp.components._structures.InputUriPlaceholder, kfp.components._structures.OutputUriPlaceholder, kfp.components._structures.InputMetadataPlaceholder, kfp.components._structures.InputOutputPortNamePlaceholder, kfp.components._structures.OutputMetadataPlaceholder, kfp.components._structures.ExecutorInputPlaceholder, ConcatPlaceholder, IfPlaceholder, List[Union[str, kfp.components._structures.InputValuePlaceholder, kfp.components._structures.InputPathPlaceholder, kfp.components._structures.OutputPathPlaceholder, kfp.components._structures.InputUriPlaceholder, kfp.components._structures.OutputUriPlaceholder, kfp.components._structures.InputMetadataPlaceholder, kfp.components._structures.InputOutputPortNamePlaceholder, kfp.components._structures.OutputMetadataPlaceholder, kfp.components._structures.ExecutorInputPlaceholder, ConcatPlaceholder, IfPlaceholder]]], else_value: Union[str, kfp.components._structures.InputValuePlaceholder, kfp.components._structures.InputPathPlaceholder, kfp.components._structures.OutputPathPlaceholder, kfp.components._structures.InputUriPlaceholder, kfp.components._structures.OutputUriPlaceholder, kfp.components._structures.InputMetadataPlaceholder, kfp.components._structures.InputOutputPortNamePlaceholder, kfp.components._structures.OutputMetadataPlaceholder, kfp.components._structures.ExecutorInputPlaceholder, ConcatPlaceholder, IfPlaceholder, List[Union[str, kfp.components._structures.InputValuePlaceholder, kfp.components._structures.InputPathPlaceholder, kfp.components._structures.OutputPathPlaceholder, kfp.components._structures.InputUriPlaceholder, kfp.components._structures.OutputUriPlaceholder, kfp.components._structures.InputMetadataPlaceholder, kfp.components._structures.InputOutputPortNamePlaceholder, kfp.components._structures.OutputMetadataPlaceholder, kfp.components._structures.ExecutorInputPlaceholder, ConcatPlaceholder, IfPlaceholder]], None] = None)[source]

Bases: kfp.components.modelbase.ModelBase

Used in by the IfPlaceholder - the command-line argument placeholder that will be replaced at run-time by the expanded value of either “then_value” or “else_value” depending on the submissio-time resolved value of the “cond” predicate.

class kfp.components.structures.InputMetadataPlaceholder(input_name: str)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the file path to an input artifact metadata.

During runtime, this command-line argument placeholder will be replaced by the path where the metadata file associated with this artifact has been written to. Currently only supported in v2 components.

class kfp.components.structures.InputOutputPortNamePlaceholder(input_name: str)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the output port name of an input artifact.

During compile time, this command-line argument placeholder will be replaced by the actual output port name used by the producer task. Currently only supported in v2 components.

class kfp.components.structures.InputPathPlaceholder(input_name: str)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the command-line argument placeholder that will be replaced at run-time by a local file path pointing to a file containing the input argument value.

class kfp.components.structures.InputSpec(name: str, type: Union[str, Dict[KT, VT], List[T], None] = None, description: Optional[str] = None, default: Union[str, int, float, bool, None] = None, optional: Optional[bool] = False, annotations: Optional[Dict[str, Any]] = None)[source]

Bases: kfp.components.modelbase.ModelBase

Describes the component input specification.

class kfp.components.structures.InputUriPlaceholder(input_name: str)[source]

Bases: kfp.components.modelbase.ModelBase

Represents a placeholder for the URI of an input artifact.

Represents the command-line argument placeholder that will be replaced at run-time by the URI of the input artifact argument.

class kfp.components.structures.InputValuePlaceholder(input_name: str)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the command-line argument placeholder that will be replaced at run-time by the input argument value.

class kfp.components.structures.IsPresentPlaceholder(input_name: str)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the command-line argument placeholder that will be replaced at run-time by a boolean value specifying whether the caller has passed an argument for the specified optional input.

class kfp.components.structures.LessThenOrEqualPredicate(operands: kfp.components._structures.TwoOperands)[source]

Bases: kfp.components._structures.BinaryPredicate

Represents the “less than or equal” comparison predicate.

class kfp.components.structures.LessThenPredicate(operands: kfp.components._structures.TwoOperands)[source]

Bases: kfp.components._structures.BinaryPredicate

Represents the “less than” comparison predicate.

class kfp.components.structures.NotEqualsPredicate(operands: kfp.components._structures.TwoOperands)[source]

Bases: kfp.components._structures.BinaryPredicate

Represents the “not equals” comparison predicate.

class kfp.components.structures.NotPredicate(operand: Union[str, int, float, bool, kfp.components._structures.GraphInputArgument, kfp.components._structures.TaskOutputArgument, kfp.components._structures.EqualsPredicate, kfp.components._structures.NotEqualsPredicate, kfp.components._structures.GreaterThanPredicate, kfp.components._structures.GreaterThanOrEqualPredicate, kfp.components._structures.LessThenPredicate, kfp.components._structures.LessThenOrEqualPredicate, NotPredicate, AndPredicate, OrPredicate])[source]

Bases: kfp.components.modelbase.ModelBase

Represents the “not” logical operation.

class kfp.components.structures.OrPredicate(operands: kfp.components._structures.TwoBooleanOperands)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the “or” logical operation.

class kfp.components.structures.OutputMetadataPlaceholder(output_metadata: None = None)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the output metadata JSON file location of this task.

This file will encode the metadata information produced by this task: - Artifacts metadata, but not the content of the artifact, and - output parameters.

Only supported in v2 components.

to_dict() → Mapping[str, Any][source]
class kfp.components.structures.OutputPathPlaceholder(output_name: str)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the command-line argument placeholder that will be replaced at run-time by a local file path pointing to a file where the program should write its output data.

class kfp.components.structures.OutputSpec(name: str, type: Union[str, Dict[KT, VT], List[T], None] = None, description: Optional[str] = None, annotations: Optional[Dict[str, Any]] = None)[source]

Bases: kfp.components.modelbase.ModelBase

Describes the component output specification.

class kfp.components.structures.OutputUriPlaceholder(output_name: str)[source]

Bases: kfp.components.modelbase.ModelBase

Represents a placeholder for the URI of an output artifact.

Represents the command-line argument placeholder that will be replaced at run-time by a URI of the output artifac where the program should write its output data.

class kfp.components.structures.PipelineRunSpec(root_task: kfp.components._structures.TaskSpec)[source]

Bases: kfp.components.modelbase.ModelBase

The object that can be sent to the backend to start a new Run.

class kfp.components.structures.RetryStrategySpec(max_retries: int)[source]

Bases: kfp.components.modelbase.ModelBase

class kfp.components.structures.TaskOutputArgument(task_output: kfp.components._structures.TaskOutputReference)[source]

Bases: kfp.components.modelbase.ModelBase

Represents the component argument value that comes from the output of another task.

static construct(task_id: str, output_name: str) → kfp.components._structures.TaskOutputArgument[source]
with_type(type_spec: Union[str, Dict[KT, VT], List[T]]) → kfp.components._structures.TaskOutputArgument[source]
without_type() → kfp.components._structures.TaskOutputArgument[source]
class kfp.components.structures.TaskOutputReference(output_name: str, task_id: Optional[str] = None, task: Optional[TaskSpec] = None, type: Union[str, Dict[KT, VT], List[T], None] = None)[source]

Bases: kfp.components.modelbase.ModelBase

References the output of some task (the scope is a single graph).

with_type(type_spec: Union[str, Dict[KT, VT], List[T]]) → kfp.components._structures.TaskOutputReference[source]
without_type() → kfp.components._structures.TaskOutputReference[source]
class kfp.components.structures.TaskSpec(component_ref: kfp.components._structures.ComponentReference, arguments: Optional[Mapping[str, Union[str, int, float, bool, kfp.components._structures.GraphInputArgument, kfp.components._structures.TaskOutputArgument]]] = None, is_enabled: Union[str, int, float, bool, kfp.components._structures.GraphInputArgument, kfp.components._structures.TaskOutputArgument, kfp.components._structures.EqualsPredicate, kfp.components._structures.NotEqualsPredicate, kfp.components._structures.GreaterThanPredicate, kfp.components._structures.GreaterThanOrEqualPredicate, kfp.components._structures.LessThenPredicate, kfp.components._structures.LessThenOrEqualPredicate, NotPredicate, AndPredicate, OrPredicate, None] = None, execution_options: Optional[kfp.components._structures.ExecutionOptionsSpec] = None, annotations: Optional[Dict[str, Any]] = None)[source]

Bases: kfp.components.modelbase.ModelBase

Task specification.

Task is a “configured” component - a component supplied with arguments and other applied configuration changes.