<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Kubeflow – Building Pipelines with the SDK</title>
    <link>/docs/pipelines/sdk/</link>
    <description>Recent content in Building Pipelines with the SDK on Kubeflow</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    
	  <atom:link href="/docs/pipelines/sdk/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Docs: Introduction to the Pipelines SDK</title>
      <link>/docs/pipelines/sdk/sdk-overview/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/sdk-overview/</guid>
      <description>
        
        
        &lt;div class=&#34;alert alert-warning&#34; role=&#34;alert&#34;&gt;
  &lt;h4 class=&#34;alert-heading&#34;&gt;Beta&lt;/h4&gt;
  This Kubeflow component has &lt;b&gt;beta&lt;/b&gt; status. See the
  &lt;a href=&#34;/docs/reference/version-policy/&#34;&gt;Kubeflow versioning policies&lt;/a&gt;.
  The Kubeflow team is interested in your   
  &lt;a href=&#34;https://github.com/kubeflow/pipelines/issues&#34;&gt;feedback&lt;/a&gt;&lt;/h4&gt; 
  about the usability of the feature.
&lt;/div&gt;
&lt;p&gt;The &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.html&#34;&gt;Kubeflow Pipelines
SDK&lt;/a&gt;
provides a set of Python packages that you can use to specify and run your
machine learning (ML) workflows. A &lt;em&gt;pipeline&lt;/em&gt; is a description of an ML
workflow, including all of the &lt;em&gt;components&lt;/em&gt; that make up the steps in the
workflow and how the components interact with each other.&lt;/p&gt;
&lt;h2 id=&#34;sdk-packages&#34;&gt;SDK packages&lt;/h2&gt;
&lt;p&gt;The Kubeflow Pipelines SDK includes the following packages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.compiler.html&#34;&gt;&lt;code&gt;kfp.compiler&lt;/code&gt;&lt;/a&gt;
includes classes and methods for compiling pipeline Python DSL into a workflow yaml spec
Methods in this package include, but are not limited
to, the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kfp.compiler.Compiler.compile&lt;/code&gt; compiles your Python DSL code into a single
static configuration (in YAML format) that the Kubeflow Pipelines service
can process. The Kubeflow Pipelines service converts the static
configuration into a set of Kubernetes resources for execution.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.components.html&#34;&gt;&lt;code&gt;kfp.components&lt;/code&gt;&lt;/a&gt;
includes classes and methods for interacting with pipeline components.
Methods in this package include, but are not limited to, the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kfp.components.func_to_container_op&lt;/code&gt; converts a Python function to a
pipeline component and returns a factory function.
You can then call the factory function to construct an instance of a
pipeline task
(&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ContainerOp&#34;&gt;&lt;code&gt;ContainerOp&lt;/code&gt;&lt;/a&gt;)
that runs the original function in a container.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kfp.components.load_component_from_file&lt;/code&gt; loads a pipeline component from
a file and returns a factory function.
You can then call the factory function to construct an instance of a
pipeline task
(&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ContainerOp&#34;&gt;&lt;code&gt;ContainerOp&lt;/code&gt;&lt;/a&gt;)
that runs the component container image.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kfp.components.load_component_from_url&lt;/code&gt; loads a pipeline component from
a URL and returns a factory function.
You can then call the factory function to construct an instance of a
pipeline task
(&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ContainerOp&#34;&gt;&lt;code&gt;ContainerOp&lt;/code&gt;&lt;/a&gt;)
that runs the component container image.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html&#34;&gt;&lt;code&gt;kfp.dsl&lt;/code&gt;&lt;/a&gt;
contains the domain-specific language (DSL) that you can use to define and
interact with pipelines and components.
Methods, classes, and modules in this package include, but are not limited to,
the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kfp.dsl.PipelineParam&lt;/code&gt; represents a pipeline parameter that you can pass
from one pipeline component to another. See the guide to
&lt;a href=&#34;/docs/pipelines/sdk/parameters/&#34;&gt;pipeline parameters&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kfp.dsl.component&lt;/code&gt; is a decorator for DSL functions that returns a
pipeline component.
(&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ContainerOp&#34;&gt;&lt;code&gt;ContainerOp&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kfp.dsl.pipeline&lt;/code&gt; is a decorator for Python functions that returns a
pipeline.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kfp.dsl.python_component&lt;/code&gt; is a decorator for Python functions that adds
pipeline component metadata to the function object.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.types.html&#34;&gt;&lt;code&gt;kfp.dsl.types&lt;/code&gt;&lt;/a&gt;
contains a list of types defined by the Kubeflow Pipelines SDK. Types
include basic types like &lt;code&gt;String&lt;/code&gt;, &lt;code&gt;Integer&lt;/code&gt;, &lt;code&gt;Float&lt;/code&gt;, and &lt;code&gt;Bool&lt;/code&gt;, as well
as domain-specific types like &lt;code&gt;GCPProjectID&lt;/code&gt; and &lt;code&gt;GCRPath&lt;/code&gt;.
See the guide to
&lt;a href=&#34;/docs/pipelines/sdk/static-type-checking&#34;&gt;DSL static type checking&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ResourceOp&#34;&gt;&lt;code&gt;kfp.dsl.ResourceOp&lt;/code&gt;&lt;/a&gt;
represents a pipeline task (op) which lets you directly manipulate
Kubernetes resources (&lt;code&gt;create&lt;/code&gt;, &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;apply&lt;/code&gt;, &amp;hellip;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.VolumeOp&#34;&gt;&lt;code&gt;kfp.dsl.VolumeOp&lt;/code&gt;&lt;/a&gt;
represents a pipeline task (op) which creates a new &lt;code&gt;PersistentVolumeClaim&lt;/code&gt;
(PVC). It aims to make the common case of creating a &lt;code&gt;PersistentVolumeClaim&lt;/code&gt;
fast.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.VolumeSnapshotOp&#34;&gt;&lt;code&gt;kfp.dsl.VolumeSnapshotOp&lt;/code&gt;&lt;/a&gt;
represents a pipeline task (op) which creates a new &lt;code&gt;VolumeSnapshot&lt;/code&gt;. It
aims to make the common case of creating a &lt;code&gt;VolumeSnapshot&lt;/code&gt; fast.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.PipelineVolume&#34;&gt;&lt;code&gt;kfp.dsl.PipelineVolume&lt;/code&gt;&lt;/a&gt;
represents a volume used to pass data between pipeline steps. &lt;code&gt;ContainerOp&lt;/code&gt;s
can mount a &lt;code&gt;PipelineVolume&lt;/code&gt; either via the constructor&amp;rsquo;s argument
&lt;code&gt;pvolumes&lt;/code&gt; or &lt;code&gt;add_pvolumes()&lt;/code&gt; method.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ParallelFor&#34;&gt;&lt;code&gt;kfp.dsl.ParallelFor&lt;/code&gt;&lt;/a&gt;
represents a parallel for loop over a static or dynamic set of items in a pipeline.
Each iteration of the for loop is executed in parallel.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ExitHandler&#34;&gt;&lt;code&gt;kfp.dsl.ExitHandler&lt;/code&gt;&lt;/a&gt;
represents an exit handler that is invoked upon exiting a pipeline. A typical
usage of &lt;code&gt;ExitHandler&lt;/code&gt; is garbage collection.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.Condition&#34;&gt;&lt;code&gt;kfp.dsl.Condition&lt;/code&gt;&lt;/a&gt;
represents a group of ops, that will only be executed when a certain condition is met.
The condition specified need to be determined at runtime, by incorporating at least one task output,
or PipelineParam in the boolean expression.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.client.html&#34;&gt;&lt;code&gt;kfp.Client&lt;/code&gt;&lt;/a&gt;
contains the Python client libraries for the &lt;a href=&#34;/docs/pipelines/reference/api/kubeflow-pipeline-api-spec/&#34;&gt;Kubeflow Pipelines
API&lt;/a&gt;.
Methods in this package include, but are not limited to, the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kfp.Client.create_experiment&lt;/code&gt; creates a pipeline
&lt;a href=&#34;/docs/pipelines/concepts/experiment/&#34;&gt;experiment&lt;/a&gt; and returns an
experiment object.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kfp.Client.run_pipeline&lt;/code&gt; runs a pipeline and returns a run object.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kfp.Client.create_run_from_pipeline_func&lt;/code&gt; compiles a pipeline function and submits it
for execution on Kubeflow Pipelines.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kfp.Client.create_run_from_pipeline_package&lt;/code&gt; runs a local pipeline package on Kubeflow Pipelines.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kfp.Client.upload_pipeline&lt;/code&gt; uploads a local file to create a new pipeline in Kubeflow Pipelines.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kfp.Client.upload_pipeline_version&lt;/code&gt; uploads a local file to create a pipeline version. &lt;a href=&#34;/docs/pipelines/tutorials/sdk-examples&#34;&gt;Follow an example to learn more about creating a pipeline version&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.extensions.html&#34;&gt;Kubeflow Pipelines extension modules&lt;/a&gt;
include classes and functions for specific platforms on which you can use
Kubeflow Pipelines. Examples include utility functions for on premises,
Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubeflow/pipelines/tree/master/sdk/python/kfp/cli/diagnose_me&#34;&gt;Kubeflow Pipelines diagnose_me modules&lt;/a&gt;include classes and functions that help with environment diagnostic tasks.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kfp.cli.diagnose_me.dev_env&lt;/code&gt; reports on diagnostic metadata from your development environment, such as your python library version.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kfp.cli.diagnose_me.kubernetes_cluster&lt;/code&gt; reports on diagnostic data from your Kubernetes cluster, such as Kubernetes secrets.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kfp.cli.diagnose_me.gcp&lt;/code&gt; reports on diagnostic data related to your GCP environment.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;kubeflow-pipelines-cli-tool&#34;&gt;Kubeflow Pipelines CLI tool&lt;/h2&gt;
&lt;p&gt;The Kubeflow Pipelines CLI tool enables you to use a subset of the Kubeflow Pipelines SDK directly from the command line. The Kubeflow Pipelines CLI tool provides the following commands:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kfp diagnose_me&lt;/code&gt; runs environment diagnostic with specified parameters.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--json&lt;/code&gt; - Indicates that this command must return its results as JSON. Otherwise, results are returned in human readable format.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--namespace TEXT&lt;/code&gt; - Specifies the Kubernetes namespace to use. all-namespaces is the default value.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--project-id TEXT&lt;/code&gt; - For GCP deployments, this value specifies the GCP project to use. If this value is not specified, the environment default is used.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kfp pipeline &amp;lt;COMMAND&amp;gt;&lt;/code&gt; provides the following commands to help you manage pipelines.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;get&lt;/code&gt;  - Gets detailed information about a Kubeflow pipeline from your Kubeflow Pipelines cluster.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;list&lt;/code&gt; - Lists the pipelines that have been uploaded to your Kubeflow Pipelines cluster.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;upload&lt;/code&gt; - Uploads a pipeline to your Kubeflow Pipelines cluster.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kfp run &amp;lt;COMMAND&amp;gt;&lt;/code&gt; provides the following commands to help you manage pipeline runs.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;get&lt;/code&gt; - Displays the details of a pipeline run.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;list&lt;/code&gt; - Lists recent pipeline runs.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;submit&lt;/code&gt; - Submits a pipeline run.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kfp --endpoint &amp;lt;ENDPOINT&amp;gt;&lt;/code&gt; - Specifies the endpoint that the Kubeflow Pipelines CLI should connect to.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;installing-the-sdk&#34;&gt;Installing the SDK&lt;/h2&gt;
&lt;p&gt;Follow the guide to
&lt;a href=&#34;/docs/pipelines/sdk/install-sdk/&#34;&gt;installing the Kubeflow Pipelines SDK&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;building-pipelines-and-components&#34;&gt;Building pipelines and components&lt;/h2&gt;
&lt;p&gt;This section summarizes the ways you can use the SDK to build pipelines and
components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#standard-component-outside-app&#34;&gt;Creating components from existing application
code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#standard-component-in-app&#34;&gt;Creating components within your application code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#lightweight-component&#34;&gt;Creating lightweight components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#prebuilt-component&#34;&gt;Using prebuilt, reusuable components in your pipeline&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The diagrams provide a conceptual guide to the relationships between the
following concepts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Your Python code&lt;/li&gt;
&lt;li&gt;A pipeline component&lt;/li&gt;
&lt;li&gt;A Docker container image&lt;/li&gt;
&lt;li&gt;A pipeline&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a id=&#34;standard-component-outside-app&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;creating-components-from-existing-application-code&#34;&gt;Creating components from existing application code&lt;/h3&gt;
&lt;p&gt;This section describes how to create a component and a pipeline &lt;em&gt;outside&lt;/em&gt; your
Python application, by creating components from existing containerized
applications. This technique is useful when you have already created a
TensorFlow program, for example, and you want to use it in a pipeline.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/pipelines-sdk-outside-app.svg&#34; 
alt=&#34;Creating components outside your application code&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;p&gt;Below is a more detailed explanation of the above diagram:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Write your application code, &lt;code&gt;my-app-code.py&lt;/code&gt;. For example, write code to
transform data or train a model.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a &lt;a href=&#34;https://docs.docker.com/get-started/&#34;&gt;Docker&lt;/a&gt; container image that
packages your program (&lt;code&gt;my-app-code.py&lt;/code&gt;) and upload the container image to a
registry. To build a container image based on a given
&lt;a href=&#34;https://docs.docker.com/engine/reference/builder/&#34;&gt;Dockerfile&lt;/a&gt;, you can use
the &lt;a href=&#34;https://docs.docker.com/engine/reference/commandline/cli/&#34;&gt;Docker command-line
interface&lt;/a&gt;
or the
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.compiler.html#kfp.compiler.build_docker_image&#34;&gt;&lt;code&gt;kfp.compiler.build_docker_image&lt;/code&gt; method&lt;/a&gt; from the Kubeflow Pipelines
SDK.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Write a component function using the Kubeflow Pipelines DSL to define your
pipeline&amp;rsquo;s interactions with the component’s Docker container. Your
component function must return a
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ContainerOp&#34;&gt;&lt;code&gt;kfp.dsl.ContainerOp&lt;/code&gt;&lt;/a&gt;.
Optionally, you can use the &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.component&#34;&gt;&lt;code&gt;kfp.dsl.component&lt;/code&gt;
decorator&lt;/a&gt;
to enable &lt;a href=&#34;/docs/pipelines/sdk/static-type-checking&#34;&gt;static type checking&lt;/a&gt; in
the DSL compiler. To use the decorator, you can add the &lt;code&gt;@kfp.dsl.component&lt;/code&gt;
annotation to your component function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@kfp.dsl.component&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_component&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_param&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;...&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;ContainerOp&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My component name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;image&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gcr.io/path/to/container/image&amp;#39;&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Write a pipeline function using the Kubeflow Pipelines DSL to define the
pipeline and include all the pipeline components. Use the &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.pipeline&#34;&gt;&lt;code&gt;kfp.dsl.pipeline&lt;/code&gt;
decorator&lt;/a&gt;
to build a pipeline from your pipeline function. To use the decorator, you can
add the &lt;code&gt;@kfp.dsl.pipeline&lt;/code&gt; annotation to your pipeline function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@kfp.dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My machine learning pipeline&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;param_1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;PipelineParam&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;param_2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;PipelineParam&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;my_step&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_component&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_param&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Compile the pipeline to generate a compressed YAML definition of the
pipeline. The Kubeflow Pipelines service converts the static configuration
into a set of Kubernetes resources for execution.&lt;/p&gt;
&lt;p&gt;To compile the pipeline, you can choose one of the following
options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Use the
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.compiler.html#kfp.compiler.Compiler&#34;&gt;&lt;code&gt;kfp.compiler.Compiler.compile&lt;/code&gt;&lt;/a&gt;
method:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;compiler&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Compiler&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;compile&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;  
  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline.zip&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Alternatively, use the &lt;code&gt;dsl-compile&lt;/code&gt; command on the command line.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;dsl-compile --py &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt;path/to/python/file&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt; --output my-pipeline.zip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the Kubeflow Pipelines SDK to run the pipeline:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Client&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;my_experiment&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;create_experiment&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;demo&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;my_run&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;run_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_experiment&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; 
  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline.zip&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can also choose to share your pipeline as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Upload the pipeline zip file to the Kubeflow Pipelines UI. For more
information about the UI, see the &lt;a href=&#34;/docs/pipelines/pipelines-quickstart/&#34;&gt;Kubeflow Pipelines quickstart
guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Upload the pipeline zip file to a shared repository. See the
&lt;a href=&#34;/docs/examples/shared-resources/&#34;&gt;reusable components and other shared resources&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;alert alert-info&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;More about the above workflow&lt;/h4&gt;
&lt;p&gt;For more detailed instructions, see the guide to &lt;a href=&#34;/docs/pipelines/sdk/build-component/&#34;&gt;building components and
pipelines&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For an example, see the
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/xgboost_training_cm/xgboost_training_cm.py&#34;&gt;&lt;code&gt;xgboost-training-cm.py&lt;/code&gt;&lt;/a&gt;
pipeline sample on GitHub. The pipeline creates an XGBoost model using
structured data in CSV format.&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a id=&#34;standard-component-in-app&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;creating-components-within-your-application-code&#34;&gt;Creating components within your application code&lt;/h3&gt;
&lt;p&gt;This section describes how to create a pipeline component &lt;em&gt;inside&lt;/em&gt; your
Python application, as part of the application. The DSL code for creating a
component therefore runs inside your Docker container.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/pipelines-sdk-within-app.svg&#34; 
alt=&#34;Building components within your application code&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;p&gt;Below is a more detailed explanation of the above diagram:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Write your code in a Python function. For example, write code to transform
data or train a model:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_python_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
  &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.python_component&#34;&gt;&lt;code&gt;kfp.dsl.python_component&lt;/code&gt;
decorator&lt;/a&gt;
to convert your Python function into
a pipeline component. To use the decorator, you can add the
&lt;code&gt;@kfp.dsl.python_component&lt;/code&gt; annotation to your function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@kfp.dsl.python_component&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My awesome component&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Come and play&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_python_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
  &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.compiler.html#kfp.compiler.build_python_component&#34;&gt;&lt;code&gt;kfp.compiler.build_python_component&lt;/code&gt;&lt;/a&gt;
to create a container image for the component.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;my_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;compiler&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;build_python_component&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;component_func&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_python_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;staging_gcs_path&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;OUTPUT_DIR&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;target_image&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;TARGET_IMAGE&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Write a pipeline function using the Kubeflow Pipelines DSL to define the
pipeline and include all the pipeline components. Use the &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.pipeline&#34;&gt;&lt;code&gt;kfp.dsl.pipeline&lt;/code&gt;
decorator&lt;/a&gt;
to build a pipeline from your pipeline function, by adding
the &lt;code&gt;@kfp.dsl.pipeline&lt;/code&gt; annotation to your pipeline function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@kfp.dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My machine learning pipeline&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;param_1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;PipelineParam&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;param_2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;PipelineParam&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;my_step&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Compile the pipeline to generate a compressed YAML definition of the
pipeline. The Kubeflow Pipelines service converts the static configuration
into a set of Kubernetes resources for execution.&lt;/p&gt;
&lt;p&gt;To compile the pipeline, you can choose one of the following
options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Use the
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.compiler.html#kfp.compiler.Compiler&#34;&gt;&lt;code&gt;kfp.compiler.Compiler.compile&lt;/code&gt;&lt;/a&gt;
method:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;compiler&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Compiler&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;compile&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;  
  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline.zip&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Alternatively, use the &lt;code&gt;dsl-compile&lt;/code&gt; command on the command line.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;dsl-compile --py &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt;path/to/python/file&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt; --output my-pipeline.zip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the Kubeflow Pipelines SDK to run the pipeline:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Client&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;my_experiment&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;create_experiment&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;demo&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;my_run&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;run_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_experiment&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; 
  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline.zip&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can also choose to share your pipeline as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Upload the pipeline zip file to the Kubeflow Pipelines UI. For more
information about the UI, see the &lt;a href=&#34;/docs/pipelines/pipelines-quickstart/&#34;&gt;Kubeflow Pipelines quickstart
guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Upload the pipeline zip file to a shared repository. See the
&lt;a href=&#34;/docs/examples/shared-resources/&#34;&gt;reusable components and other shared resources&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;alert alert-info&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;More about the above workflow&lt;/h4&gt;
For an example of the above workflow, see the
Jupyter notebook titled &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/container_build/container_build.ipynb&#34;&gt;KubeFlow Pipelines container building&lt;/a&gt; on GitHub.
&lt;/div&gt;

&lt;p&gt;&lt;a id=&#34;lightweight-component&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;creating-lightweight-components&#34;&gt;Creating lightweight components&lt;/h3&gt;
&lt;p&gt;This section describes how to create lightweight Python components that do not
require you to build a container image. Lightweight components simplify
prototyping and rapid development, especially in a Jupyter notebook environment.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/pipelines-sdk-lightweight.svg&#34; 
alt=&#34;Building lightweight Python components&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;p&gt;Below is a more detailed explanation of the above diagram:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Write your code in a Python function. For example, write code to transform
data or train a model:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_python_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
  &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.components.html#kfp.components.func_to_container_op&#34;&gt;&lt;code&gt;kfp.components.func_to_container_op&lt;/code&gt;&lt;/a&gt;
to convert your Python function into a pipeline component:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;my_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;components&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;func_to_container_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_python_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Optionally, you can write the component to a file that you can share or use
in another pipeline:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;my_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;components&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;func_to_container_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_python_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; 
  &lt;span style=&#34;color:#000&#34;&gt;output_component_file&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-op.component&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If you stored your lightweight component in a file as described in the
previous step, use
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.components.html#kfp.components.load_component_from_file&#34;&gt;&lt;code&gt;kfp.components.load_component_from_file&lt;/code&gt;&lt;/a&gt;
to load the component:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;my_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;components&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;load_component_from_file&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-op.component&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Write a pipeline function using the Kubeflow Pipelines DSL to define the
pipeline and include all the pipeline components. Use the &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.pipeline&#34;&gt;&lt;code&gt;kfp.dsl.pipeline&lt;/code&gt;
decorator&lt;/a&gt;
to build a pipeline from your pipeline function, by adding
the &lt;code&gt;@kfp.dsl.pipeline&lt;/code&gt; annotation to your pipeline function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@kfp.dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My machine learning pipeline&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;param_1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;PipelineParam&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;param_2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;PipelineParam&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;my_step&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Compile the pipeline to generate a compressed YAML definition of the
pipeline. The Kubeflow Pipelines service converts the static configuration
into a set of Kubernetes resources for execution.&lt;/p&gt;
&lt;p&gt;To compile the pipeline, you can choose one of the following
options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Use the
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.compiler.html#kfp.compiler.Compiler&#34;&gt;&lt;code&gt;kfp.compiler.Compiler.compile&lt;/code&gt;&lt;/a&gt;
method:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;compiler&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Compiler&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;compile&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;  
  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline.zip&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Alternatively, use the &lt;code&gt;dsl-compile&lt;/code&gt; command on the command line.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;dsl-compile --py &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt;path/to/python/file&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt; --output my-pipeline.zip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the Kubeflow Pipelines SDK to run the pipeline:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Client&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;my_experiment&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;create_experiment&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;demo&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;my_run&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;run_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_experiment&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; 
  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline.zip&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;div class=&#34;alert alert-info&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;More about the above workflow&lt;/h4&gt;
&lt;p&gt;For more detailed instructions, see the guide to &lt;a href=&#34;/docs/pipelines/sdk/lightweight-python-components/&#34;&gt;building lightweight
components&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For an example, see the &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/lightweight_component/lightweight_component.ipynb&#34;&gt;Lightweight Python components -
basics&lt;/a&gt;
notebook on GitHub.&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a id=&#34;prebuilt-component&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;using-prebuilt-reusable-components-in-your-pipeline&#34;&gt;Using prebuilt, reusable components in your pipeline&lt;/h3&gt;
&lt;p&gt;A reusable component is one that someone has built and made available for others
to use. To use the component in your pipeline, you need the YAML file that
defines the component.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/pipelines-sdk-reusable.svg&#34; 
alt=&#34;Using prebuilt, reusable components in your pipeline&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;p&gt;Below is a more detailed explanation of the above diagram:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Find the YAML file that defines the reusable component. For example, take a
look at the &lt;a href=&#34;/docs/examples/shared-resources/&#34;&gt;reusable components and other shared
resources&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.components.html#kfp.components.load_component_from_url&#34;&gt;&lt;code&gt;kfp.components.load_component_from_url&lt;/code&gt;&lt;/a&gt;
to load the component:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;my_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;components&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;load_component_from_url&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;https://path/to/component.yaml&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Write a pipeline function using the Kubeflow Pipelines DSL to define the
pipeline and include all the pipeline components. Use the &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.pipeline&#34;&gt;&lt;code&gt;kfp.dsl.pipeline&lt;/code&gt;
decorator&lt;/a&gt;
to build a pipeline from your pipeline function, by adding
the &lt;code&gt;@kfp.dsl.pipeline&lt;/code&gt; annotation to your pipeline function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@kfp.dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My machine learning pipeline&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;param_1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;PipelineParam&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;param_2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;PipelineParam&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;my_step&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Compile the pipeline to generate a compressed YAML definition of the
pipeline. The Kubeflow Pipelines service converts the static configuration
into a set of Kubernetes resources for execution.&lt;/p&gt;
&lt;p&gt;To compile the pipeline, you can choose one of the following
options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Use the
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.compiler.html#kfp.compiler.Compiler&#34;&gt;&lt;code&gt;kfp.compiler.Compiler.compile&lt;/code&gt;&lt;/a&gt;
method:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;compiler&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Compiler&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;compile&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;  
  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline.zip&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Alternatively, use the &lt;code&gt;dsl-compile&lt;/code&gt; command on the command line.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;dsl-compile --py &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt;path/to/python/file&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt; --output my-pipeline.zip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the Kubeflow Pipelines SDK to run the pipeline:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Client&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;my_experiment&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;create_experiment&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;demo&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;my_run&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;run_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_experiment&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; 
  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;my-pipeline.zip&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;div class=&#34;alert alert-info&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;More about the above workflow&lt;/h4&gt;
For an example, see the
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/xgboost_training_cm/xgboost_training_cm.py&#34;&gt;&lt;code&gt;xgboost-training-cm.py&lt;/code&gt;&lt;/a&gt;
pipeline sample on GitHub. The pipeline creates an XGBoost model using
structured data in CSV format.
&lt;/div&gt;

&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;/docs/pipelines/sdk/parameters/&#34;&gt;Use pipeline parameters&lt;/a&gt; to pass data between components.&lt;/li&gt;
&lt;li&gt;Learn how to &lt;a href=&#34;/docs/pipelines/sdk/dsl-recursion&#34;&gt;write recursive functions in the
DSL&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Build a &lt;a href=&#34;/docs/pipelines/sdk/component-development/&#34;&gt;reusable component&lt;/a&gt; for
sharing in multiple pipelines.&lt;/li&gt;
&lt;li&gt;Find out how to use the DSL to &lt;a href=&#34;/docs/pipelines/sdk/manipulate-resources/&#34;&gt;manipulate Kubernetes resources dynamically
as steps of your pipeline&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Install the Kubeflow Pipelines SDK</title>
      <link>/docs/pipelines/sdk/install-sdk/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/install-sdk/</guid>
      <description>
        
        
        &lt;p&gt;This guide tells you how to install the
&lt;a href=&#34;https://github.com/kubeflow/pipelines/tree/master/sdk&#34;&gt;Kubeflow Pipelines SDK&lt;/a&gt;
which you can use to build machine learning pipelines. You can use the SDK
to execute your pipeline, or alternatively you can upload the pipeline to
the Kubeflow Pipelines UI for execution.&lt;/p&gt;
&lt;p&gt;All of the SDK&amp;rsquo;s classes and methods are described in the auto-generated &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/&#34;&gt;SDK reference docs&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;set-up-python&#34;&gt;Set up Python&lt;/h2&gt;
&lt;p&gt;You need &lt;strong&gt;Python 3.5&lt;/strong&gt; or later to use the Kubeflow Pipelines SDK. This
guide uses Python 3.7.&lt;/p&gt;
&lt;p&gt;If you haven&amp;rsquo;t yet set up a Python 3 environment, do so now. This guide
recommends &lt;a href=&#34;https://conda.io/miniconda.html&#34;&gt;Miniconda&lt;/a&gt;, but you can use
a virtual environment manager of your choice, such as &lt;code&gt;virtualenv&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Follow the steps below to set
up Python using &lt;a href=&#34;https://conda.io/miniconda.html&#34;&gt;Miniconda&lt;/a&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Choose one of the following methods to install Miniconda, depending on your
environment:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Debian/Ubuntu/&lt;a href=&#34;https://console.cloud.google.com/cloudshell&#34;&gt;Cloud Shell&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;apt-get update&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt; apt-get install -y wget bzip2
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Windows: Download the
&lt;a href=&#34;https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe&#34;&gt;installer&lt;/a&gt;
and make sure you select the option to
&lt;strong&gt;Add Miniconda to my PATH environment variable&lt;/strong&gt; during the installation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;MacOS: Download the
&lt;a href=&#34;https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh&#34;&gt;installer&lt;/a&gt;
and run the following command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;bash Miniconda3-latest-MacOSX-x86_64.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check that the &lt;code&gt;conda&lt;/code&gt; command is available:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;which conda
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the &lt;code&gt;conda&lt;/code&gt; command is not found, add Miniconda to your path:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;color:#204a87&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;PATH&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&amp;lt;YOUR_MINICONDA_PATH&amp;gt;/bin:&lt;span style=&#34;color:#000&#34;&gt;$PATH&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a clean Python 3 environment with a name of your choosing. This
example uses Python 3.7 and an environment name of &lt;code&gt;mlpipeline&lt;/code&gt;.:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;conda create --name mlpipeline &lt;span style=&#34;color:#000&#34;&gt;python&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;3.7
conda activate mlpipeline
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;install-the-kubeflow-pipelines-sdk&#34;&gt;Install the Kubeflow Pipelines SDK&lt;/h2&gt;
&lt;p&gt;Run the following command to install the Kubeflow Pipelines SDK:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;pip3 install kfp --upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you are not using a virtual environment, such as &lt;code&gt;conda&lt;/code&gt;, when installing the Kubeflow Pipelines SDK, you may receive the following error:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;ERROR: Could not install packages due to an EnvironmentError: &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt;Errno 13&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt; Permission denied: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/usr/local/lib/python3.5/dist-packages/kfp-&amp;lt;version&amp;gt;.dist-info&amp;#39;&lt;/span&gt;
Consider using the &lt;span style=&#34;color:#4e9a06&#34;&gt;`&lt;/span&gt;--user&lt;span style=&#34;color:#4e9a06&#34;&gt;`&lt;/span&gt; option or check the permissions.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you get this error, install &lt;code&gt;kfp&lt;/code&gt; with the &lt;code&gt;--user&lt;/code&gt; option:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;pip3 install kfp --upgrade --user
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This command installs the &lt;code&gt;dsl-compile&lt;/code&gt; and &lt;code&gt;kfp&lt;/code&gt; binaries under &lt;code&gt;~/.local/bin&lt;/code&gt;, which is not part of the PATH in some Linux distributions, such as Ubuntu. You can add &lt;code&gt;~/.local/bin&lt;/code&gt; to your PATH by appending the following to a new line at the end of your &lt;code&gt;.bashrc&lt;/code&gt; file:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;color:#204a87&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;PATH&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;$PATH&lt;/span&gt;:~/.local/bin
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After successful installation, the command &lt;code&gt;dsl-compile&lt;/code&gt; should be available.
You can use this command to verify it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;which dsl-compile
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The response should be something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/&amp;lt;PATH_TO_YOUR_USER_BIN&amp;gt;/miniconda3/envs/mlpipeline/bin/dsl-compile
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;/docs/pipelines/sdk/sdk-overview/&#34;&gt;See how to use the SDK&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/pipelines/sdk/build-component/&#34;&gt;Build a component and a pipeline&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/pipelines/pipelines-quickstart&#34;&gt;Get started with the UI&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/pipelines/concepts/&#34;&gt;Understand pipeline concepts&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Build Components and Pipelines</title>
      <link>/docs/pipelines/sdk/build-component/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/build-component/</guid>
      <description>
        
        
        

&lt;div class=&#34;alert alert-warning&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;Out of date&lt;/h4&gt;
This guide contains outdated information pertaining to Kubeflow 1.0. This guide
needs to be updated for Kubeflow 1.1.
&lt;/div&gt;

&lt;p&gt;This page describes how to create a component for Kubeflow Pipelines and how
to combine components into a pipeline. For an easier start, experiment with
&lt;a href=&#34;/docs/pipelines/tutorials/build-pipeline/&#34;&gt;the Kubeflow Pipelines samples&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;overview-of-pipelines-and-components&#34;&gt;Overview of pipelines and components&lt;/h2&gt;
&lt;p&gt;A &lt;em&gt;pipeline&lt;/em&gt; is a description of a machine learning (ML) workflow, including all
of the components of the workflow and how they work together. The pipeline
includes the definition of the inputs (parameters) required to run the pipeline
and the inputs and outputs of each component.&lt;/p&gt;
&lt;p&gt;A pipeline &lt;em&gt;component&lt;/em&gt; is an implementation of a pipeline task. A component
represents a step in the workflow. Each component takes one or more inputs and
may produce one or more outputs. A component consists of an interface
(inputs/outputs), the implementation (a Docker container image and command-line
arguments) and metadata (name, description).&lt;/p&gt;
&lt;p&gt;For more information, see the conceptual guides to
&lt;a href=&#34;/docs/pipelines/concepts/pipeline/&#34;&gt;pipelines&lt;/a&gt;
and &lt;a href=&#34;/docs/pipelines/concepts/component/&#34;&gt;components&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-start&#34;&gt;Before you start&lt;/h2&gt;
&lt;p&gt;Set up your environment:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install &lt;a href=&#34;https://www.docker.com/get-docker&#34;&gt;Docker&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Install the &lt;a href=&#34;/docs/pipelines/sdk/install-sdk/&#34;&gt;Kubeflow Pipelines SDK&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The examples on this page come from the
&lt;a href=&#34;https://github.com/kubeflow/pipelines/tree/master/samples/core/xgboost_training_cm&#34;&gt;XGBoost Spark pipeline sample&lt;/a&gt;
in the Kubeflow Pipelines sample repository.&lt;/p&gt;
&lt;h2 id=&#34;create-a-container-image-for-each-component&#34;&gt;Create a container image for each component&lt;/h2&gt;
&lt;p&gt;This section assumes that you have already created a program to perform the
task required in a particular step of your ML workflow. For example, if the
task is to train an ML model, then you must have a program that does the
training, such as the program that
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/components/deprecated/dataproc/train/src/train.py&#34;&gt;trains an XGBoost model&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Create a &lt;a href=&#34;https://docs.docker.com/get-started/&#34;&gt;Docker&lt;/a&gt; container image that
packages your program. See the
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/components/deprecated/dataproc/train/Dockerfile&#34;&gt;Docker file&lt;/a&gt;
for the example XGBoost model training program mentioned above. You can also
examine the generic
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/components/build_image.sh&#34;&gt;&lt;code&gt;build_image.sh&lt;/code&gt;&lt;/a&gt;
script in the Kubeflow Pipelines repository of reusable components.&lt;/p&gt;
&lt;p&gt;Your component can create outputs that the downstream components can use as
inputs. Each output must be a string and the container image must write each
output to a separate local text file. For example, if a training component needs
to output the path of the trained model, the component writes the path into a
local file, such as &lt;code&gt;/output.txt&lt;/code&gt;. In the Python class that defines your
pipeline (see &lt;a href=&#34;#define-pipeline&#34;&gt;below&lt;/a&gt;) you can
specify how to map the content of local files to component outputs.&lt;/p&gt;
&lt;h2 id=&#34;create-a-python-function-to-wrap-your-component&#34;&gt;Create a Python function to wrap your component&lt;/h2&gt;
&lt;p&gt;Define a Python function to describe the interactions with the Docker container
image that contains your pipeline component. For example, the following
Python function describes a component that trains an XGBoost model:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dataproc_train_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;project&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;region&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;cluster_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;train_data&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;eval_data&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;target&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;analysis&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;workers&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;rounds&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;is_classification&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#3465a4&#34;&gt;True&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;is_classification&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;config&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gs://ml-pipeline-playground/trainconfcla.json&amp;#39;&lt;/span&gt;
    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;else&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;config&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gs://ml-pipeline-playground/trainconfreg.json&amp;#39;&lt;/span&gt;

    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;ContainerOp&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
        &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Dataproc - Train XGBoost model&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
        &lt;span style=&#34;color:#000&#34;&gt;image&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gcr.io/ml-pipeline/ml-pipeline-dataproc-train:ac833a084b32324b56ca56e9109e05cde02816a4&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
        &lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--project&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;project&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--region&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;region&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--cluster&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;cluster_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--train&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;train_data&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--eval&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;eval_data&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--analysis&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;analysis&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--target&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;target&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--package&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gs://ml-pipeline-playground/xgboost4j-example-0.8-SNAPSHOT-jar-with-dependencies.jar&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--workers&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;workers&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--rounds&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;rounds&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--conf&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;config&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--output&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;],&lt;/span&gt;
        &lt;span style=&#34;color:#000&#34;&gt;file_outputs&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;output&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/output.txt&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The function must return a dsl.ContainerOp from the
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/xgboost_training_cm/xgboost_training_cm.py&#34;&gt;XGBoost Spark pipeline sample&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Each component must inherit from
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/dsl/_container_op.py&#34;&gt;&lt;code&gt;dsl.ContainerOp&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Values in the &lt;code&gt;arguments&lt;/code&gt; list that&amp;rsquo;s used by the &lt;code&gt;dsl.ContainerOp&lt;/code&gt; constructor above must be either Python scalar types (such as &lt;code&gt;str&lt;/code&gt; and &lt;code&gt; int&lt;/code&gt;) or &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/dsl/_pipeline_param.py&#34;&gt;&lt;code&gt;dsl.PipelineParam&lt;/code&gt;&lt;/a&gt; types. Each &lt;code&gt;dsl.PipelineParam&lt;/code&gt; represents a parameter whose value is usually only known at run time. The value is
either provided by the user at pipeline run time or received as an output from an upstream component.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Although the value of each &lt;code&gt;dsl.PipelineParam&lt;/code&gt; is only available at run time,
you can still use the parameters inline in the &lt;code&gt;arguments&lt;/code&gt; by using &lt;code&gt;%s&lt;/code&gt;
variable substitution. At run time the argument contains the value of the
parameter.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;file_outputs&lt;/code&gt; is a mapping between labels and local file paths. In the above
example, the content of &lt;code&gt;/output.txt&lt;/code&gt; contains the string output of the
component. To reference the output in code:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dataproc_train_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;op&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;outputs&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;label&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If there is only one output then you can also use &lt;code&gt;op.output&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a id=&#34;define-pipeline&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;define-your-pipeline-as-a-python-function&#34;&gt;Define your pipeline as a Python function&lt;/h2&gt;
&lt;p&gt;You must describe each pipeline as a Python function. For example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;XGBoost Trainer&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;A trainer that does end-to-end distributed training for XGBoost models.&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;xgb_train_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;project&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;region&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;us-central1&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;train_data&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gs://ml-pipeline-playground/sfpd/train.csv&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;eval_data&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gs://ml-pipeline-playground/sfpd/eval.csv&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;schema&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gs://ml-pipeline-playground/sfpd/schema.json&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;target&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;resolution&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;rounds&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;200&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;workers&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;true_label&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;ACTION&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;@dsl.pipeline&lt;/strong&gt; is a required decoration including the &lt;code&gt;name&lt;/code&gt; and
&lt;code&gt;description&lt;/code&gt; properties.&lt;/li&gt;
&lt;li&gt;Input arguments show up as pipeline parameters on the Kubeflow Pipelines UI.
As a Python rule, positional arguments appear first, followed by keyword
arguments.&lt;/li&gt;
&lt;li&gt;Each function argument is of type
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/dsl/_pipeline_param.py&#34;&gt;&lt;code&gt;dsl.PipelineParam&lt;/code&gt;&lt;/a&gt;.
The default values should all be of that type. The default values show up in
the Kubeflow Pipelines UI but the user can override them.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See the full code in the
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/xgboost_training_cm/xgboost_training_cm.py&#34;&gt;XGBoost Spark pipeline sample&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;compile-the-pipeline&#34;&gt;Compile the pipeline&lt;/h2&gt;
&lt;p&gt;After defining the pipeline in Python as described above, you must compile the
pipeline to an intermediate representation before you can submit it to the
Kubeflow Pipelines service. The intermediate representation is a workflow
specification in the form of a YAML file compressed into a
&lt;code&gt;.tar.gz&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;Use the &lt;code&gt;dsl-compile&lt;/code&gt; command to compile your pipeline:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;dsl-compile --py &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt;path/to/python/file&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt; --output &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt;path/to/output/tar.gz&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;deploy-the-pipeline&#34;&gt;Deploy the pipeline&lt;/h2&gt;
&lt;p&gt;Upload the generated &lt;code&gt;.tar.gz&lt;/code&gt; file through the Kubeflow Pipelines UI. See the
guide to &lt;a href=&#34;/docs/pipelines/pipelines-quickstart&#34;&gt;getting started with the UI&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Build a &lt;a href=&#34;/docs/pipelines/sdk/component-development/&#34;&gt;reusable component&lt;/a&gt; for
sharing in multiple pipelines.&lt;/li&gt;
&lt;li&gt;Learn more about the
&lt;a href=&#34;/docs/pipelines/sdk/dsl-overview/&#34;&gt;Kubeflow Pipelines domain-specific language (DSL)&lt;/a&gt;,
a set of Python libraries that you can use to specify ML pipelines.&lt;/li&gt;
&lt;li&gt;See how to &lt;a href=&#34;/docs/pipelines/metrics/pipelines-metrics/&#34;&gt;export metrics from your
pipeline&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Visualize the output of your component by
&lt;a href=&#34;/docs/pipelines/metrics/output-viewer/&#34;&gt;adding metadata for an output
viewer&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;For quick iteration,
&lt;a href=&#34;/docs/pipelines/sdk/lightweight-python-components/&#34;&gt;build lightweight components&lt;/a&gt;
directly from Python functions.&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Create Reusable Components</title>
      <link>/docs/pipelines/sdk/component-development/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/component-development/</guid>
      <description>
        
        
        

&lt;div class=&#34;alert alert-warning&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;Out of date&lt;/h4&gt;
This guide contains outdated information pertaining to Kubeflow 1.0. This guide
needs to be updated for Kubeflow 1.1.
&lt;/div&gt;

&lt;p&gt;This page describes how to author a reusable component that you can
load and use as part of a pipeline.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re new to
pipelines, see the conceptual guides to &lt;a href=&#34;/docs/pipelines/concepts/pipeline/&#34;&gt;pipelines&lt;/a&gt;
and &lt;a href=&#34;/docs/pipelines/concepts/component/&#34;&gt;components&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This tutorial describes the manual way of writing a full component program (in any language) and a component definition for it.
For quickly building component from a python function see &lt;a href=&#34;/docs/pipelines/sdk/lightweight-python-components/&#34;&gt;Build component from Python function&lt;/a&gt; and &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/tutorials/Data%20passing%20in%20python%20components.ipynb&#34;&gt;Data Passing in Python components&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;summary&#34;&gt;Summary&lt;/h2&gt;
&lt;p&gt;Below is a summary of the steps involved in creating and using a component:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Write the program that contains your component&amp;rsquo;s logic. The program must
use files and command-line arguments to pass data to and from the component.&lt;/li&gt;
&lt;li&gt;Containerize the program.&lt;/li&gt;
&lt;li&gt;Write a component specification in YAML format that describes the
component for the Kubeflow Pipelines system.&lt;/li&gt;
&lt;li&gt;Use the Kubeflow Pipelines SDK to load your component, use it in a pipeline and run that pipeline.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The rest of this page gives some explanation about input and output data,
followed by detailed descriptions of the above steps.&lt;/p&gt;
&lt;h2 id=&#34;components-and-data-passing&#34;&gt;Components and data passing&lt;/h2&gt;
&lt;p&gt;The concept of component is very similar to the concept of a function.
Every component can have inputs and outputs (which must be declared in the component specification).
The component code takes the data passed to its inputs and produces the data for its outputs.
A pipeline then connects component instances together by passing data from outputs of some components to inputs of other components.
That&amp;rsquo;s very similar to how a function calls other functions and passes the results between them.
The Pipelines system handles the actual data passing while the components are responsible for consuming the input data and producing the output data.&lt;/p&gt;
&lt;h2 id=&#34;passing-the-data-to-and-from-the-containerized-program&#34;&gt;Passing the data to and from the containerized program&lt;/h2&gt;
&lt;p&gt;When creating a component you need to think about how the component
will communicate with upstream and downstream components. That is, how it will consume
the input data and produce the output data.&lt;/p&gt;
&lt;h3 id=&#34;producing-data&#34;&gt;Producing data&lt;/h3&gt;
&lt;p&gt;To output any piece of data, the component program must write the output data to some location and inform the system
about that location so that the system can pass the data between steps.
The program should accept the paths for the output data as command-line arguments. That is, you should not hardcode the paths.&lt;/p&gt;
&lt;p&gt;In practical terms this means that the program should receive local paths for every output the component produces and write data to those paths.
Usually an output is a single piece of data. In this case the program should treat the given output path as a file path, open it for writing and write the data there.
In some cases there is a need to output a directory of files. In this case the program should treat the given output path as a directory path, create a directory at that location and then add files to that directory. In both cases it might be necessary to create parent directories if they do not exist.&lt;/p&gt;
&lt;h4 id=&#34;advanced-producing-data-in-an-external-system&#34;&gt;Advanced: Producing data in an external system&lt;/h4&gt;
&lt;p&gt;In some scenarios, the goal of the component is to create some data object in an external service (for example a BigQuery table).
In this case the component program should do that and then output some identifier of the produced data location (for example BigQuery table name) instead of the data itself.
This scenario should be limited to cases where the data must be put into external system instead of keeping it inside the Kubeflow Pipelines system.
The class of components where this behavior is common is exporters (for example &amp;ldquo;upload data to GCS&amp;rdquo;).
Note that the Pipelines system cannot provide consistency and reproducibility guarantees for the data outside of its control.&lt;/p&gt;
&lt;h3 id=&#34;consuming-data&#34;&gt;Consuming data&lt;/h3&gt;
&lt;p&gt;There are two main ways a command-line program usually consumes data:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Small pieces of data are usually passed as command-line arguments: &lt;code&gt;program.py --param1 100&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Bigger data or binary data is usually stored in files and then the file paths are passed to the program: &lt;code&gt;program.py --data1 /inputs/data1.txt&lt;/code&gt;. The system needs to be aware about the need to put some data into files and pass their paths to the program.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;writing-the-program-code&#34;&gt;Writing the program code&lt;/h2&gt;
&lt;p&gt;This section describes an example program that has two inputs (for small and
large pieces of data) and one output. Although the programming language in this example
is Python 3, you can build your component in any language.&lt;/p&gt;
&lt;h3 id=&#34;programpy&#34;&gt;program.py&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#!/usr/bin/env python3&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;argparse&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;pathlib&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Path&lt;/span&gt;

&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Function doing the actual work (Outputs first N lines from a text file)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;do_work&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;input1_file&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;output1_file&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;param1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;for&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;x&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;line&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;in&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;enumerate&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;input1_file&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;x&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;param1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
      &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;break&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;_&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;output1_file&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;line&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Defining and parsing the command-line arguments&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;parser&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;argparse&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;ArgumentParser&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My program description&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;parser&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;add_argument&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--input1-path&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;type&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;help&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Path of the local file containing the Input 1 data.&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Paths should be passed in, not hardcoded&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;parser&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;add_argument&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--param1&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;type&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#204a87&#34;&gt;int&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;default&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;100&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;help&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Parameter 1.&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;parser&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;add_argument&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--output1-path&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;type&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;help&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Path of the local file where the Output 1 data should be written.&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Paths should be passed in, not hardcoded&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;args&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;parser&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;parse_args&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;

&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Creating the directory where the output file will be created (the directory may or may not exist).&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;Path&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;args&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output1_path&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;parent&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;mkdir&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;parents&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#3465a4&#34;&gt;True&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;exist_ok&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#3465a4&#34;&gt;True&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;

&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;open&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;args&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;input1_path&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;r&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;input1_file&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;open&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;args&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output1_path&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;output1_file&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
        &lt;span style=&#34;color:#000&#34;&gt;do_work&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;input1_file&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;output1_file&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;args&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;param1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The command line invocation of this program is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;python3 program.py --input1-path &amp;lt;local file path to Input 1 data&amp;gt; \
                   --param1 &amp;lt;value of Param1 input&amp;gt; \
                   --output1-path &amp;lt;local file path for the Output 1 data&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;writing-a-dockerfile-to-containerize-your-application&#34;&gt;Writing a Dockerfile to containerize your application&lt;/h2&gt;
&lt;p&gt;You need a &lt;a href=&#34;https://docs.docker.com/get-started/&#34;&gt;Docker&lt;/a&gt; container image that
packages your program.&lt;/p&gt;
&lt;p&gt;The instructions on creating container images are not specific to Kubeflow
Pipelines. To make things easier for you, this section provides some guidelines
on standard container creation. You can use any procedure
of your choice to create the Docker containers.&lt;/p&gt;
&lt;p&gt;Your &lt;a href=&#34;https://docs.docker.com/engine/reference/builder/&#34;&gt;Dockerfile&lt;/a&gt; must
contain all program code, including the wrapper, and the dependencies (operating
system packages, external libraries, etc).&lt;/p&gt;
&lt;p&gt;Ensure you have write access to a container registry where you can push
the container image. Examples include
&lt;a href=&#34;https://cloud.google.com/container-registry/docs/&#34;&gt;Google Container Registry&lt;/a&gt;
and &lt;a href=&#34;https://hub.docker.com/&#34;&gt;Docker Hub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Think of a name for your container image. This guide uses the name
`gcr.io/my-org/my-image&#39;.&lt;/p&gt;
&lt;h3 id=&#34;example-dockerfile&#34;&gt;Example Dockerfile&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;FROM python:3.7
RUN python3 -m pip install keras
COPY ./src /pipelines/component/src
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a &lt;code&gt;build_image.sh&lt;/code&gt; script (see example below) to build the container
image based on the Dockerfile and push the container image to some container
repository.&lt;/p&gt;
&lt;p&gt;Run the &lt;code&gt;build_image.sh&lt;/code&gt; script to build the container image based on the Dockerfile
and push it to your chosen container repository.&lt;/p&gt;
&lt;p&gt;Best practice: After pushing the image, get the strict image name with digest,
and use the strict image name for reproducibility.&lt;/p&gt;
&lt;h3 id=&#34;example-build_imagesh&#34;&gt;Example build_image.sh:&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#!/bin/bash -e
&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;image_name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;gcr.io/my-org/my-image &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Specify the image name here&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;image_tag&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;latest
&lt;span style=&#34;color:#000&#34;&gt;full_image_name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;${&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;image_name&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;}&lt;/span&gt;:&lt;span style=&#34;color:#4e9a06&#34;&gt;${&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;image_tag&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;}&lt;/span&gt;

&lt;span style=&#34;color:#204a87&#34;&gt;cd&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;$(&lt;/span&gt;dirname &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;$0&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; 
docker build -t &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;${&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;full_image_name&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; .
docker push &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;$full_image_name&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt;

&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Output the strict image name (which contains the sha256 image digest)&lt;/span&gt;
docker inspect --format&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;{{index .RepoDigests 0}}&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;${&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;full_image_name&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Make your script executable:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;chmod +x build_image.sh
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;writing-your-component-definition-file&#34;&gt;Writing your component definition file&lt;/h2&gt;
&lt;p&gt;To create a component from your containerized program you need to write component specification in YAML format that describes the
component for the Kubeflow Pipelines system.&lt;/p&gt;
&lt;p&gt;For the complete definition of a Kubeflow Pipelines component, see the
&lt;a href=&#34;/docs/pipelines/reference/component-spec/&#34;&gt;component specification&lt;/a&gt;.
However, for this tutorial you don&amp;rsquo;t need to know the full schema of the
component specification. The tutorial provides enough information for the
relevant the components.&lt;/p&gt;
&lt;p&gt;Start writing the component definition (&lt;code&gt;component.yaml&lt;/code&gt;) by specifying your
container image in the component&amp;rsquo;s implementation section:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;implementation:
  container:
    image: gcr.io/my-org/my-image@sha256:a172..752f # Name of a container image that you&#39;ve pushed to a container repo.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Complete the component&amp;rsquo;s implementation section based on your program:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;implementation:
  container:
    image: gcr.io/my-org/my-image@sha256:a172..752f
    # command is a list of strings (command-line arguments). 
    # The YAML language has two syntaxes for lists and you can use either of them. 
    # Here we use the &amp;quot;flow syntax&amp;quot; - comma-separated strings inside square brackets.
    command: [
      python3, /kfp/component/src/program.py, # Path of the program inside the container
      --input1-path, &amp;lt;local file path for the Input 1 data&amp;gt;,
      --param1, &amp;lt;value of Param1 input&amp;gt;,
      --output1-path, &amp;lt;local file path for the Output 1 data&amp;gt;,
    ]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;command&lt;/code&gt; section still contains some dummy placeholders (in angle
brackets). Let&amp;rsquo;s replace them with real placeholders. A &lt;em&gt;placeholder&lt;/em&gt; represents
a command-line argument that is replaced with some value or path before the
program is executed. In &lt;code&gt;component.yaml&lt;/code&gt;, you specify the placeholders using
YAML&amp;rsquo;s mapping syntax to distinguish them from the verbatim strings. There are
three placeholders available:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;{inputValue: Some input name}&lt;/code&gt;&lt;br&gt;
This placeholder is replaced with the &lt;strong&gt;value&lt;/strong&gt; of the argument to the
specified input. This is useful for small pieces of input data.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;{inputPath: Some input name}&lt;/code&gt;&lt;br&gt;
This placeholder is replaced with the auto-generated &lt;strong&gt;local path&lt;/strong&gt; where the
system will put the input data passed to the component during the pipeline run.
This placeholder instructs the system to write the input argument data to a file and pass the path of that data file to the component program.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;{outputPath: Some output name}&lt;/code&gt;&lt;br&gt;
This placeholder is replaced with the auto-generated &lt;strong&gt;local path&lt;/strong&gt; where the
program should write its output data. This instructs the system to read the
content of the file and store it as the value of the specified output.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition to putting real placeholders in the command line, you need to add
corresponding input and output specifications to the inputs and outputs
sections. The input/output specification contains the input name, type,
description and default value. Only the name is required. The input and output
names are free-form strings, but be careful with the YAML syntax and use quotes
if necessary. The input/output names do not need to be the same as the
command-line flags which are usually quite short.&lt;/p&gt;
&lt;p&gt;Replace the placeholders as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Replace &lt;code&gt;&amp;lt;local file path for the Input 1 data&amp;gt;&lt;/code&gt; with &lt;code&gt;{inputPath: Input 1}&lt;/code&gt; and
add &lt;code&gt;Input 1&lt;/code&gt; to the &lt;code&gt;inputs&lt;/code&gt; section.
them in as command-line arguments.&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;&amp;lt;value of Param1 input&amp;gt;&lt;/code&gt; with &lt;code&gt;{inputValue: Parameter 1}&lt;/code&gt; and add
&lt;code&gt;Parameter 1&lt;/code&gt; to the &lt;code&gt;inputs&lt;/code&gt; section. Integers are small, so we&amp;rsquo;re passing
them in as command-line arguments.&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;&amp;lt;local file path for the Output 1 data&amp;gt;&lt;/code&gt; with &lt;code&gt;{outputPath: Output 1}&lt;/code&gt;
and add &lt;code&gt;Output 1&lt;/code&gt; to the &lt;code&gt;outputs&lt;/code&gt; section.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After replacing the placeholders and adding inputs/outputs, your
&lt;code&gt;component.yaml&lt;/code&gt; looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;inputs: #List of input specs. Each input spec is a map.
- {name: Input 1}
- {name: Parameter 1}
outputs:
- {name: Output 1}
implementation:
  container:
    image: gcr.io/my-org/my-image@sha256:a172..752f
    command: [
      python3, /pipelines/component/src/program.py,

      --input1-path,
      {inputPath: Input 1}, # Refers to the &amp;quot;Input 1&amp;quot; input

      --param1,
      {inputValue: Parameter 1}, # Refers to the &amp;quot;Parameter 1&amp;quot; input

      --output1-path,
      {outputPath: Output 1}, # Refers to the &amp;quot;Output 1&amp;quot; output
    ]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The above component specification is sufficient, but you should add more
metadata to make it more useful. The example below includes the following
additions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Component name and description.&lt;/li&gt;
&lt;li&gt;For each input and output: description, default value, and type.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Final version of &lt;code&gt;component.yaml&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;name: Do dummy work
description: Performs some dummy work.
inputs:
- {name: Input 1, type: GCSPath, description: &#39;Data for Input 1&#39;}
- {name: Parameter 1, type: Integer, default: &#39;100&#39;, description: &#39;Parameter 1 description&#39;} # The default values must be specified as YAML strings.
outputs:
- {name: Output 1, description: &#39;Output 1 data&#39;}
implementation:
  container:
    image: gcr.io/my-org/my-image@sha256:a172..752f
    command: [
      python3, /pipelines/component/src/program.py,
      --input1-path,  {inputPath:  Input 1},
      --param1,       {inputValue: Parameter 1},
      --output1-path, {outputPath: Output 1},
    ]
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;build-your-component-into-a-pipeline-with-the-kubeflow-pipelines-sdk&#34;&gt;Build your component into a pipeline with the Kubeflow Pipelines SDK&lt;/h2&gt;
&lt;p&gt;Here is a sample pipeline that shows how to load a component and use it to
compose a pipeline.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Load the component by calling load_component_from_file or load_component_from_url&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# To load the component, the pipeline author only needs to have access to the component.yaml file.&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# The Kubernetes cluster executing the pipeline needs access to the container image specified in the component.&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;dummy_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;components&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;load_component_from_file&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;os&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;path&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;join&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;component_root&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;component.yaml&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;))&lt;/span&gt; 
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# dummy_op = kfp.components.load_component_from_url(&amp;#39;http://....../component.yaml&amp;#39;)&lt;/span&gt;

&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Load two more components for importing and exporting the data:&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;download_from_gcs_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;components&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;load_component_from_url&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;http://....../component.yaml&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;upload_to_gcs_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;components&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;load_component_from_url&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;http://....../component.yaml&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;

&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# dummy_op is now a &amp;#34;factory function&amp;#34; that accepts the arguments for the component&amp;#39;s inputs&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# and produces a task object (e.g. ContainerOp instance).&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Inspect the dummy_op function in Jupyter Notebook by typing &amp;#34;dummy_op(&amp;#34; and pressing Shift+Tab&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# You can also get help by writing help(dummy_op) or dummy_op? or dummy_op??&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# The signature of the dummy_op function corresponds to the inputs section of the component.&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Some tweaks are performed to make the signature valid and pythonic:&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# 1) All inputs with default values will come after the inputs without default values&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# 2) The input names are converted to pythonic names (spaces and symbols replaced&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#    with underscores and letters lowercased).&lt;/span&gt;

&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Define a pipeline and create a task from a component:&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;():&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;dummy1_task&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dummy_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
        &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Input name &amp;#34;Input 1&amp;#34; is converted to pythonic parameter name &amp;#34;input_1&amp;#34;&lt;/span&gt;
        &lt;span style=&#34;color:#000&#34;&gt;input_1&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;one&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;two&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;three&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;four&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;five&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;six&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;seven&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;eight&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;nine&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;ten&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
        &lt;span style=&#34;color:#000&#34;&gt;parameter_1&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;5&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# The outputs of the dummy1_task can be referenced using the&lt;/span&gt;
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# dummy1_task.outputs dictionary: dummy1_task.outputs[&amp;#39;output_1&amp;#39;]&lt;/span&gt;
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# ! The output names are converted to pythonic (&amp;#34;snake_case&amp;#34;) names.&lt;/span&gt;

&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# This pipeline can be compiled, uploaded and submitted for execution.&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Client&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;create_run_from_pipeline_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;my_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;organizing-the-component-files&#34;&gt;Organizing the component files&lt;/h2&gt;
&lt;p&gt;This section provides a recommended way to organize the component files. There
is no requirement that you must organize the files in this way. However, using
the standard organization makes it possible to reuse the same scripts for
testing, image building and component versioning.&lt;br&gt;
See this
&lt;a href=&#34;https://github.com/kubeflow/pipelines/tree/master/components/sample/keras/train_classifier&#34;&gt;sample component&lt;/a&gt;
for a real-life component example.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;components/&amp;lt;component group&amp;gt;/&amp;lt;component name&amp;gt;/

    src/*            #Component source code files
    tests/*          #Unit tests
    run_tests.sh     #Small script that runs the tests
    README.md        #Documentation. Move to docs/ if multiple files needed

    Dockerfile       #Dockerfile to build the component container image
    build_image.sh   #Small script that runs docker build and docker push

    component.yaml   #Component definition in YAML format
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Consolidate what you&amp;rsquo;ve learned by reading the
&lt;a href=&#34;/docs/pipelines/sdk/best-practices&#34;&gt;best practices&lt;/a&gt; for designing and
writing components.&lt;/li&gt;
&lt;li&gt;For quick iteration,
&lt;a href=&#34;/docs/pipelines/sdk/lightweight-python-components/&#34;&gt;build lightweight components&lt;/a&gt;
directly from Python functions.&lt;/li&gt;
&lt;li&gt;See how to &lt;a href=&#34;/docs/pipelines/metrics/pipelines-metrics/&#34;&gt;export metrics from your
pipeline&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Visualize the output of your component by
&lt;a href=&#34;/docs/pipelines/metrics/output-viewer/&#34;&gt;adding metadata for an output
viewer&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Explore the &lt;a href=&#34;/docs/examples/shared-resources/&#34;&gt;reusable components and other shared
resources&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Building Python function-based components</title>
      <link>/docs/pipelines/sdk/python-function-components/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/python-function-components/</guid>
      <description>
        
        
        &lt;!--
AUTOGENERATED FROM content/en/docs/pipelines/sdk/python-function-components.ipynb
PLEASE UPDATE THE JUPYTER NOTEBOOK AND REGENERATE THIS FILE USING scripts/nb_to_md.py.--&gt;
&lt;style&gt;
.notebook-links {display: flex; margin: 1em 0;}
.notebook-links a {padding: .75em; margin-right: .75em; font-weight: bold;}
a.colab-link {
padding-left: 3.25em;
background-image: url(/docs/images/logos/colab.ico);
background-repeat: no-repeat;
background-size: contain;
}
a.github-link {
padding-left: 2.75em;
background-image: url(/docs/images/logos/github.png);
background-repeat: no-repeat;
background-size: auto 75%;
background-position: left center;
}
&lt;/style&gt;
&lt;div class=&#34;notebook-links&#34;&gt;
&lt;a class=&#34;colab-link&#34; href=&#34;https://colab.research.google.com/github/kubeflow/website/blob/master/content/en/docs/pipelines/sdk/python-function-components.ipynb&#34;&gt;Run in Google Colab&lt;/a&gt;
&lt;a class=&#34;github-link&#34; href=&#34;https://github.com/kubeflow/website/blob/master/content/en/docs/pipelines/sdk/python-function-components.ipynb&#34;&gt;View source on GitHub&lt;/a&gt;
&lt;/div&gt;
&lt;p&gt;A Kubeflow Pipelines component is a self-contained set of code that performs one step in your
ML workflow. A pipeline component is composed of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The component code, which implements the logic needed to perform a step in your ML workflow.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A component specification, which defines the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The component&amp;rsquo;s metadata, its name and description.&lt;/li&gt;
&lt;li&gt;The component&amp;rsquo;s interface, the component&amp;rsquo;s inputs and outputs.&lt;/li&gt;
&lt;li&gt;The component&amp;rsquo;s implementation, the Docker container image
to run, how to pass inputs to your component code, and how
to get the component&amp;rsquo;s outputs.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Python function-based components make it easier to iterate quickly by letting you build your
component code as a Python function and generating the &lt;a href=&#34;https://www.kubeflow.org/docs/pipelines/reference/component-spec/&#34;&gt;component specification&lt;/a&gt; for you.
This document describes how to build Python function-based components and use them in your pipeline.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Run the following command to install the Kubeflow Pipelines SDK.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#a40000&#34;&gt;$&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;pip3&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;install&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;--&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;upgrade&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;Import the &lt;code&gt;kfp&lt;/code&gt; and &lt;code&gt;kfp.components&lt;/code&gt; packages.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp.components&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;comp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;Create an instance of the &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.client.html#kfp.Client&#34;&gt;&lt;code&gt;kfp.Client&lt;/code&gt; class&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# If you run this command on a Jupyter notebook running on Kubeflow, you can&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# exclude the host parameter.&lt;/span&gt;
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# client = kfp.Client()&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Client&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;host&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;&amp;lt;your-kubeflow-pipelines-host-name&amp;gt;&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For more information about the Kubeflow Pipelines SDK, see the &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/index.html&#34;&gt;SDK reference guide&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;getting-started-with-python-function-based-components&#34;&gt;Getting started with Python function-based components&lt;/h2&gt;
&lt;p&gt;This section demonstrates how to get started building Python function-based components by walking
through the process of creating a simple component.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Define your component&amp;rsquo;s code as a &lt;a href=&#34;#standalone&#34;&gt;standalone python function&lt;/a&gt;. In this example,
the function adds two floats and returns the sum of the two arguments.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;add&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;&amp;#39;&amp;#39;Calculates sum of two arguments&amp;#39;&amp;#39;&amp;#39;&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;Use &lt;code&gt;kfp.components.create_component_from_func&lt;/code&gt; to generate the component specification YAML and return a
factory function that you can use to create &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ContainerOp&#34;&gt;&lt;code&gt;kfp.dsl.ContainerOp&lt;/code&gt;&lt;/a&gt; class instances for your pipeline.
The component specification YAML is a reusable and shareable definition of your component.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;add_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;comp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;create_component_from_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;add&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;output_component_file&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;add_component.yaml&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;Create and run your pipeline. &lt;a href=&#34;https://www.kubeflow.org/docs/pipelines/sdk/build-component/&#34;&gt;Learn more about creating and running pipelines&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp.dsl&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;
&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Addition pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;An example pipeline that performs addition calculations.&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;add_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;3&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;7&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Passes a pipeline parameter and a constant value to the `add_op` factory&lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# function.&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;first_add_task&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;add_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;4&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Passes an output reference from `first_add_task` and a pipeline parameter&lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# to the `add_op` factory function. For operations with a single return&lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# value, the output reference can be accessed as `task.output` or&lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# `task.outputs[&amp;#39;output_name&amp;#39;]`.&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;second_add_task&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;add_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;first_add_task&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
    
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Specify argument values for your pipeline run.&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;7&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;8&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
    
&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Create a pipeline run, using the client you initialized in a prior step.&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;create_run_from_pipeline_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;add_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;building-python-function-based-components&#34;&gt;Building Python function-based components&lt;/h2&gt;
&lt;p&gt;Use the following instructions to build a Python function-based component:&lt;/p&gt;
&lt;p&gt;&lt;a name=&#34;standalone&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Define a stand-alone Python function. This function must meet the following requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;It should not use any code declared outside of the function definition.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Import statements must be added inside the function. &lt;a href=&#34;#packages&#34;&gt;Learn more about using and installing
Python packages in your component&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Helper functions must be defined inside this function.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the function accepts numeric values as parameters, the parameters must have type hints.
Supported types are &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;float&lt;/code&gt;, and &lt;code&gt;bool&lt;/code&gt;. Otherwise, parameters are passed as strings.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If your component returns multiple outputs, annotate your function with the
&lt;a href=&#34;https://docs.python.org/3/library/typing.html#typing.NamedTuple&#34;&gt;&lt;code&gt;typing.NamedTuple&lt;/code&gt;&lt;/a&gt; type hint and use the &lt;a href=&#34;https://docs.python.org/3/library/collections.html#collections.namedtuple&#34;&gt;&lt;code&gt;collections.namedtuple&lt;/code&gt;&lt;/a&gt;
function return your function&amp;rsquo;s outputs as a new subclass of tuple.&lt;/p&gt;
&lt;p&gt;You can also return metadata and metrics from your function.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Metadata helps you visualize pipeline results.
&lt;a href=&#34;https://www.kubeflow.org/docs/pipelines/sdk/output-viewer/&#34;&gt;Learn more about visualizing pipeline metadata&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Metrics help you compare pipeline runs.
&lt;a href=&#34;https://www.kubeflow.org/docs/pipelines/sdk/pipelines-metrics/&#34;&gt;Learn more about using pipeline metrics&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;typing&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;NamedTuple&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;multiple_return_values_example&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;NamedTuple&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;ExampleOutputs&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;sum&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;product&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;mlpipeline_ui_metadata&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;UI_metadata&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;mlpipeline_metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]):&lt;/span&gt;
  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&amp;#34;&amp;#34;Example function that demonstrates how to return multiple values.&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;  
  &lt;span style=&#34;color:#000&#34;&gt;sum_value&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;product_value&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;

  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Export a sample tensorboard&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;outputs&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;tensorboard&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;source&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gs://ml-pipeline-dataset/tensorboard-train&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}]&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;

  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Export two metrics&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;metrics&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;sum&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;numberValue&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;  &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;sum_value&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},{&lt;/span&gt;
        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;product&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;numberValue&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;  &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;product_value&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]&lt;/span&gt;  
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
  
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;collections&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;namedtuple&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;example_output&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;namedtuple&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;ExampleOutputs&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;sum&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;product&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;mlpipeline_ui_metadata&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;mlpipeline_metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;])&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;example_output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;sum_value&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;product_value&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;metrics&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;(Optional.) If your function has complex dependencies, choose or build a container image for your
Python function to run in. &lt;a href=&#34;#containers&#34;&gt;Learn more about selecting or building your component&amp;rsquo;s container
image&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Call &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.components.html#kfp.components.create_component_from_func&#34;&gt;&lt;code&gt;kfp.components.create_component_from_func(func)&lt;/code&gt;&lt;/a&gt; to convert
your function into a pipeline component.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;func&lt;/strong&gt;: The Python function to convert.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;base_image&lt;/strong&gt;: (Optional.) Specify the Docker container image to run this function in.
&lt;a href=&#34;#containers&#34;&gt;Learn more about selecting or building a container image&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;output_component_file&lt;/strong&gt;: (Optional.) Writes your component definition to a file. You can
use this file to share the component with colleagues or reuse it in different pipelines.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;packages_to_install&lt;/strong&gt;: (Optional.) A list of versioned Python packages to install before
running your function.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a name=&#34;packages&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;using-and-installing-python-packages&#34;&gt;Using and installing Python packages&lt;/h3&gt;
&lt;p&gt;When Kubeflow Pipelines runs your pipeline, each component runs within a Docker container image on a
Kubernetes Pod. To load the packages that your Python function depends on, one of the following must
be true:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The package must be installed on the container image.&lt;/li&gt;
&lt;li&gt;The package must be defined using the &lt;code&gt;packages_to_install&lt;/code&gt; parameter of the
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.components.html#kfp.components.create_component_from_func&#34;&gt;&lt;code&gt;kfp.components.create_component_from_func(func)&lt;/code&gt;&lt;/a&gt; function.&lt;/li&gt;
&lt;li&gt;Your function must install the package. For example, your function can use the
&lt;a href=&#34;https://docs.python.org/3/library/subprocess.html&#34;&gt;&lt;code&gt;subprocess&lt;/code&gt; module&lt;/a&gt; to run a command like &lt;code&gt;pip install&lt;/code&gt; that installs a package.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a name=&#34;containers&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;selecting-or-building-a-container-image&#34;&gt;Selecting or building a container image&lt;/h3&gt;
&lt;p&gt;Currently, if you do not specify a container image, your Python-function based component uses the
&lt;a href=&#34;https://hub.docker.com/layers/python/library/python/3.7/images/sha256-7eef781ed825f3b95c99f03f4189a8e30e718726e8490651fa1b941c6c815ad1?context=explore&#34;&gt;&lt;code&gt;python:3.7&lt;/code&gt; container image&lt;/a&gt;. If your function has complex dependencies, you may benefit
from using a container image that has your dependencies preinstalled, or building a custom container
image. Preinstalling your dependencies reduces the amount of time that your component runs in, since
your component does not need to download and install packages each time it runs.&lt;/p&gt;
&lt;p&gt;Many frameworks, such as &lt;a href=&#34;https://www.tensorflow.org/install/docker&#34;&gt;TensorFlow&lt;/a&gt; and &lt;a href=&#34;https://hub.docker.com/r/pytorch/pytorch/tags&#34;&gt;PyTorch&lt;/a&gt;, and cloud service
providers offer prebuilt container images that have common dependencies installed.&lt;/p&gt;
&lt;p&gt;If a prebuilt container is not available, you can build a custom container image with your Python
function&amp;rsquo;s dependencies. For more information about building a custom container, read the
&lt;a href=&#34;https://docs.docker.com/engine/reference/builder/&#34;&gt;Dockerfile reference guide in the Docker documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you build or select a container image, instead of using the default container image, the container
image must use Python 3.5 or later.&lt;/p&gt;
&lt;h2 id=&#34;example-python-function-based-component&#34;&gt;Example Python function-based component&lt;/h2&gt;
&lt;p&gt;This section demonstrates how to build a Python function-based component that uses imports,
helper functions, and produces multiple outputs.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Define your function. This example function uses the &lt;code&gt;numpy&lt;/code&gt; package to calcuate the quotient
and remainder for a given dividend and divisor in a helper function. In addition to the quotient
and remainder, the function also returns metadata for visualization and two metrics.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;typing&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;NamedTuple&lt;/span&gt;

&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_divmod&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dividend&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;divisor&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;NamedTuple&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;MyDivmodOutput&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;quotient&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;remainder&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;mlpipeline_ui_metadata&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;UI_metadata&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;mlpipeline_metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]):&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;&amp;#39;&amp;#39;Divides two numbers and calculate  the quotient and remainder&amp;#39;&amp;#39;&amp;#39;&lt;/span&gt;
    
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Import the numpy package inside the component function&lt;/span&gt;
    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;numpy&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;np&lt;/span&gt;

    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Define a helper function&lt;/span&gt;
    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;divmod_helper&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dividend&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;divisor&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
        &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;np&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;divmod&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dividend&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;divisor&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;

    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;quotient&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;remainder&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;divmod_helper&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dividend&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;divisor&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;

    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;tensorflow.python.lib.io&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;file_io&lt;/span&gt;
    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;
    
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Export a sample tensorboard&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;outputs&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[{&lt;/span&gt;
        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;tensorboard&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;source&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gs://ml-pipeline-dataset/tensorboard-train&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}]&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;

    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Export two metrics&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;metrics&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[{&lt;/span&gt;
          &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;quotient&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
          &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;numberValue&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;  &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;quotient&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},{&lt;/span&gt;
          &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;remainder&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
          &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;numberValue&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;  &lt;span style=&#34;color:#204a87&#34;&gt;float&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;remainder&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}]}&lt;/span&gt;

    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;collections&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;namedtuple&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;divmod_output&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;namedtuple&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;MyDivmodOutput&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;quotient&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;remainder&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;mlpipeline_ui_metadata&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;mlpipeline_metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;])&lt;/span&gt;
    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;divmod_output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;quotient&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;remainder&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dumps&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dumps&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;metrics&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;Test your function by running it directly, or with unit tests.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;my_divmod&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;100&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;7&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;
&lt;p&gt;This should return a result like the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;MyDivmodOutput(quotient=14, remainder=2, mlpipeline_ui_metadata=&#39;{&amp;quot;outputs&amp;quot;: [{&amp;quot;type&amp;quot;: &amp;quot;tensorboard&amp;quot;, &amp;quot;source&amp;quot;: &amp;quot;gs://ml-pipeline-dataset/tensorboard-train&amp;quot;}]}&#39;, mlpipeline_metrics=&#39;{&amp;quot;metrics&amp;quot;: [{&amp;quot;name&amp;quot;: &amp;quot;quotient&amp;quot;, &amp;quot;numberValue&amp;quot;: 14.0}, {&amp;quot;name&amp;quot;: &amp;quot;remainder&amp;quot;, &amp;quot;numberValue&amp;quot;: 2.0}]}&#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;code&gt;kfp.components.create_component_from_func&lt;/code&gt; to return a factory function that you can use to create
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ContainerOp&#34;&gt;&lt;code&gt;kfp.dsl.ContainerOp&lt;/code&gt;&lt;/a&gt; class instances for your pipeline. This example also specifies the base container
image to run this function in.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;divmod_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;comp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;func_to_container_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;my_divmod&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;base_image&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;tensorflow/tensorflow:1.11.0-py3&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;Define your pipeline. This example uses the &lt;code&gt;divmod_op&lt;/code&gt; factory function and the &lt;code&gt;add_op&lt;/code&gt;
factory function from an earlier example.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp.dsl&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;
&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
   &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Calculation pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
   &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;An example pipeline that performs arithmetic calculations.&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;calc_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
   &lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;1&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
   &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;7&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
   &lt;span style=&#34;color:#000&#34;&gt;c&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;17&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Passes a pipeline parameter and a constant value as operation arguments.&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;add_task&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;add_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;4&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# The add_op factory function returns&lt;/span&gt;
                            &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# a dsl.ContainerOp class instance. &lt;/span&gt;
    
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Passes the output of the add_task and a pipeline parameter as operation&lt;/span&gt;
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# arguments. For an operation with a single return value, the output&lt;/span&gt;
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# reference are accessed using `task.output` or&lt;/span&gt;
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# `task.outputs[&amp;#39;output_name&amp;#39;]`.&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;divmod_task&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;divmod_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;add_task&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;

    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# For an operation with multiple return values, output references are&lt;/span&gt;
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# accessed as `task.outputs[&amp;#39;output_name&amp;#39;]`.&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;result_task&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;add_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;divmod_task&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;outputs&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;quotient&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;],&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;c&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;5&#34;&gt;
&lt;li&gt;Create and run your pipeline. &lt;a href=&#34;https://www.kubeflow.org/docs/pipelines/sdk/build-component/&#34;&gt;Learn more about creating and running pipelines&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Specify pipeline argument values&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;7&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;8&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;

&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Submit a pipeline run&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;client&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;create_run_from_pipeline_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;calc_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;notebook-links&#34;&gt;
&lt;a class=&#34;colab-link&#34; href=&#34;https://colab.research.google.com/github/kubeflow/website/blob/master/content/en/docs/pipelines/sdk/python-function-components.ipynb&#34;&gt;Run in Google Colab&lt;/a&gt;
&lt;a class=&#34;github-link&#34; href=&#34;https://github.com/kubeflow/website/blob/master/content/en/docs/pipelines/sdk/python-function-components.ipynb&#34;&gt;View source on GitHub&lt;/a&gt;
&lt;/div&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Best Practices for Designing Components</title>
      <link>/docs/pipelines/sdk/best-practices/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/best-practices/</guid>
      <description>
        
        
        

&lt;div class=&#34;alert alert-warning&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;Out of date&lt;/h4&gt;
This guide contains outdated information pertaining to Kubeflow 1.0. This guide
needs to be updated for Kubeflow 1.1.
&lt;/div&gt;

&lt;p&gt;This page describes some recommended practices for designing
components. For an application of these best practices, see the
&lt;a href=&#34;/docs/pipelines/sdk/component-development&#34;&gt;component development guide&lt;/a&gt;. If
you&amp;rsquo;re new to pipelines, see the conceptual guides to
&lt;a href=&#34;/docs/pipelines/concepts/pipeline/&#34;&gt;pipelines&lt;/a&gt;
and &lt;a href=&#34;/docs/pipelines/concepts/component/&#34;&gt;components&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a id=&#34;general&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;general-component-design-rules&#34;&gt;General component design rules&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Design your components with composability in mind. Think about
upstream and downstream components. What formats to consume as inputs from
the upstream components. What formats to use for output data so that
downstream components can consume it.&lt;/li&gt;
&lt;li&gt;Component code must use local files for input/output data (unless impossible
&lt;ul&gt;
&lt;li&gt;for example, Cloud ML Engine and BigQuery require Cloud Storage staging
paths).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Components must be &lt;em&gt;pure&lt;/em&gt; - they must not use any outside data except data
that comes through inputs (unless impossible). Everything should either be
inside the container or come from inputs. Network access is strongly
discouraged unless that&amp;rsquo;s the explicit purpose of a component (for example,
upload/download).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;writing-component-code&#34;&gt;Writing component code&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The program must be runnable both locally and inside the Docker
container.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Programming languages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Generally, use the language that makes the most sense. If the
component wraps a Java library, then it may make sense to use Java to
expose that library.&lt;/li&gt;
&lt;li&gt;For most new components when the performance is not a concern
the Python language is preferred (use version 3 wherever possible).&lt;/li&gt;
&lt;li&gt;If a component wraps an existing program, it&amp;rsquo;s preferred to
directly expose the program in the component command line.&lt;/li&gt;
&lt;li&gt;If there needs to be some wrapper around the program (small
pre-processing or post-processing like file renaming), it can be done
with a shell script.&lt;/li&gt;
&lt;li&gt;Follow the best practices for the chosen language.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Each output data piece should be written to a separate file (see next line).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The input and output file paths must be passed in the command line and
not hard coded:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Typical command line:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;program.py --input-data &amp;lt;input path&amp;gt; --output-data &amp;lt;output path&amp;gt; --param 42
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Do NOT hardcode paths in the program:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;open(&amp;quot;/output.txt&amp;quot;, &amp;quot;w&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For temporary data you should use library functions that create
temporary files. For example, for Python use
&lt;a href=&#34;https://docs.python.org/3/library/tempfile.html&#34;&gt;https://docs.python.org/3/library/tempfile.html&lt;/a&gt;.
Do not just write to the root, or testing will be hard.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Design the code to be testable.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;writing-tests&#34;&gt;Writing tests&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Follow the &lt;a href=&#34;#general&#34;&gt;general rules&lt;/a&gt; section so that writing the tests is
easier.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the unit testing libraries that are standard for the language you&amp;rsquo;re
using.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Try to design the component code so that it can be tested using unit tests.
Do not use network unless necessary&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Prepare small input data files so that the component code can be tested in
isolation. For example, for an ML prediction component prepare a small model
and evaluation dataset.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use testing best practices.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Test the expected behavior of the code. Don&amp;rsquo;t just verify that
&amp;ldquo;nothing has changed&amp;rdquo;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For training you can look at loss at final iteration.&lt;/li&gt;
&lt;li&gt;For prediction you can look at the result metrics.&lt;/li&gt;
&lt;li&gt;For data augmenting you can check for some desired post-invariants.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the component cannot be tested locally or in isolation, then create a
small proof-of-concept pipeline that tests the component. You can use
conditionals to verify the output values of a particular task and only
enable the &amp;ldquo;success&amp;rdquo; task if the results are expected.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;writing-a-dockerfile&#34;&gt;Writing a Dockerfile&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Follow the
&lt;a href=&#34;https://docs.docker.com/develop/develop-images/dockerfile_best-practices/&#34;&gt;Docker best practices&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Structure the Dockerfile so that the required packages are installed
first and the main component scripts/binaries are added last. Ideally, split
the Dockerfile in two parts (base image and component code) so that the
main component image build is fast and more reliable (not require network
access).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;writing-a-component-specification-yaml-file&#34;&gt;Writing a component specification YAML file&lt;/h2&gt;
&lt;p&gt;For the complete definition of a Kubeflow Pipelines component, see the
&lt;a href=&#34;/docs/pipelines/reference/component-spec/&#34;&gt;component specification&lt;/a&gt;.
When creating your &lt;code&gt;component.yaml&lt;/code&gt; file, you can look at the definitions for
some
&lt;a href=&#34;https://github.com/kubeflow/pipelines/search?q=filename%3Acomponent.yaml&amp;amp;unscoped_q=filename%3Acomponent.yaml&#34;&gt;existing components&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use the &lt;code&gt;{inputValue: Input name}&lt;/code&gt; command-line placeholder for small
values that should be directly inserted into the command-line.&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;{inputPath: Input name}&lt;/code&gt; command-line placeholder for input file
locations.&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;{outputPath: Output name}&lt;/code&gt; command-line placeholder for output file
locations.&lt;/li&gt;
&lt;li&gt;Specify the full command line in ‘command:&#39; instead of just arguments to the
entry point.&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Pipeline Parameters</title>
      <link>/docs/pipelines/sdk/parameters/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/parameters/</guid>
      <description>
        
        
        &lt;p&gt;The &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.PipelineParam&#34;&gt;&lt;code&gt;kfp.dsl.PipelineParam&lt;/code&gt;
class&lt;/a&gt;
represents a reference to future data that will be passed to the pipeline or produced by a task.&lt;/p&gt;
&lt;p&gt;Your pipeline function should have parameters, so that they can later be configured in the Kubeflow Pipelines UI.&lt;/p&gt;
&lt;p&gt;When your pipeline function is called, each function argument will be a &lt;code&gt;PipelineParam&lt;/code&gt; object.
You can pass those objects to the components as arguments to instantiate them and create tasks.
A &lt;code&gt;PipelineParam&lt;/code&gt; can also represent an intermediate value that you pass between pipeline tasks.
Each task has outputs and you can get references to them from the &lt;code&gt;task.outputs[&amp;lt;output_name&amp;gt;]&lt;/code&gt; dictionary.
The task output references can again be passed to other components as arguments.&lt;/p&gt;
&lt;p&gt;In most cases you do not need to construct &lt;code&gt;PipelineParam&lt;/code&gt; objects manually.&lt;/p&gt;
&lt;p&gt;The following code sample shows how to define a pipeline with parameters:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@kfp.dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;My machine learning pipeline&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;my_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;my_num&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1000&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; 
    &lt;span style=&#34;color:#000&#34;&gt;my_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;some text&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; 
    &lt;span style=&#34;color:#000&#34;&gt;my_url&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;http://example.com&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;...&lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# In the pipeline function body you can use the `my_num`, `my_name`, &lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# `my_url` arguments as PipelineParam objects.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For more information, you can refer to the guide on
&lt;a href=&#34;/docs/pipelines/sdk/build-component/#create-a-python-class-for-your-component&#34;&gt;building components and pipelines&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Python Based Visualizations</title>
      <link>/docs/pipelines/sdk/python-based-visualizations/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/python-based-visualizations/</guid>
      <description>
        
        
        

&lt;div class=&#34;alert alert-warning&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;Deprecated&lt;/h4&gt;
Python based visualization is deprecated. We recommend fetching data via
Kubeflow Pipelines SDK and visualizing from your own notebook instead.
&lt;/div&gt;

&lt;p&gt;This page describes Python based visualizations, how to create them, and how to
use them to visualize results within the Kubeflow Pipelines UI. Python based
visualizations are available in Kubeflow Pipelines version
&lt;a href=&#34;https://github.com/kubeflow/pipelines/releases/tag/0.1.29&#34;&gt;0.1.29&lt;/a&gt; and later, and
in Kubeflow version 0.7.0 and later.&lt;/p&gt;
&lt;p&gt;While Python based visualizations are intended to be the main method of
visualizing data within the Kubeflow Pipelines UI, they do not replace the
previous method of visualizing data within the Kubeflow Pipelines UI. When
considering which method of visualization to use within your pipeline, check the
limitations of Python based visualizations in the section below and compare
them with the requirements of your visualizations.&lt;/p&gt;
&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Python based visualizations are a new method to visualize results within the
Kubeflow Pipelines UI. This new method of visualizing results is done through
the usage of &lt;a href=&#34;https://github.com/jupyter/nbconvert&#34;&gt;nbconvert&lt;/a&gt;. Alongside the
usage of nbconvert, results of a pipeline can now be visualized without a
component being included within the pipeline itself because the process of
visualizing results is now decoupled from a pipeline.&lt;/p&gt;
&lt;p&gt;Python based visualizations provide two categories of visualizations. The first
being &lt;strong&gt;predefined visualizations&lt;/strong&gt;. These visualizations are provided by
default in Kubeflow Pipelines and serve as a way for you and your customers to
easily and quickly generate powerful visualizations. The second category is
&lt;strong&gt;custom visualizations&lt;/strong&gt;. Custom visualizations allow for you and your
customers to provided Python visualization code to be used to generate
visualizations. These visualizations allow for rapid development,
experimentation, and customization when visualizing results.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/python-based-visualizations1.png&#34;
alt=&#34;Confusion matrix visualization from a pipeline component&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;using-predefined-visualizations&#34;&gt;Using predefined visualizations&lt;/h2&gt;
&lt;h3 id=&#34;predefined-matrix-visualization&#34;&gt;Predefined matrix visualization&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/python-based-visualizations2.png&#34;
alt=&#34;Confusion matrix visualization from a pipeline component&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the details of a run.&lt;/li&gt;
&lt;li&gt;Select a component.
&lt;ul&gt;
&lt;li&gt;The component that is selected does not matter. But, if you want to
visualize the output of a specific component, it is easier to do that within
that component.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Artifacts&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;At the top of the tab you should see a card named &lt;strong&gt;Visualization Creator&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Within the card, provide a visualization type, a source, and any necessary
arguments.
&lt;ul&gt;
&lt;li&gt;Any required or optional arguments will be shown as a placeholder.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Generate Visualization&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;View generated visualization by scrolling down.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;predefined-tfx-visualization&#34;&gt;Predefined TFX visualization&lt;/h3&gt;
&lt;video width=&#34;100%&#34; max-width=&#34;100%&#34; height=&#34;auto&#34; max-height=&#34;100%&#34; controls&gt;
  &lt;source src=&#34;/docs/videos/tfdv_example_with_taxi_pipeline.webm&#34; type=&#34;video/webm&#34;&gt;
&lt;/video&gt;
&lt;ol&gt;
&lt;li&gt;On the Pipelines page, click &lt;strong&gt;[Sample] Unified DSL - Taxi Tip Prediction Model Trainer&lt;/strong&gt; to open the Pipeline Details page.&lt;/li&gt;
&lt;li&gt;On the Pipeline Details page, click &lt;strong&gt;Create run&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the Create run page,
&lt;ul&gt;
&lt;li&gt;Use a run name and an experiment name of your choice.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;pipeline-root&lt;/strong&gt; field, specify a storage bucket that you have permission to write to. For example, enter the path to a Google Cloud Storage bucket or an Amazon S3 bucket.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Start&lt;/strong&gt; to create the run.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;After the run is complete, on the Run Details page, click any step. For example, click the first step &lt;strong&gt;csvexamplegen&lt;/strong&gt; as shown in the video above.&lt;/li&gt;
&lt;li&gt;In the side panel of the selected step,
&lt;ul&gt;
&lt;li&gt;Click the &lt;strong&gt;Artifacts&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Visualization Creator&lt;/strong&gt; section, choose &lt;strong&gt;TFDV&lt;/strong&gt; from the drop down menu.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Source&lt;/strong&gt; field, use &lt;strong&gt;gs://ml-pipeline-playground/tfx_taxi_simple/data/data.csv&lt;/strong&gt;, which is the input data used for this run.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Generate Visualization&lt;/strong&gt; and wait.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Move to the bottom of the &lt;strong&gt;Artifacts&lt;/strong&gt; tab to find the generated visualization.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;using-custom-visualizations&#34;&gt;Using custom visualizations&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/python-based-visualizations3.png&#34;
alt=&#34;Confusion matrix visualization from a pipeline component&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Enable custom visualizations within Kubeflow Pipelines.
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If you have not yet deployed Kubeflow Pipelines to your cluster,
you can edit the &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/manifests/kustomize/base/pipeline/ml-pipeline-ui-deployment.yaml&#34;&gt;frontend deployment YAML&lt;/a&gt;
file to include the following YAML that specifies that custom visualizations
are allowed via environment variables.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;- env:
  - name: ALLOW_CUSTOM_VISUALIZATIONS
    value: true
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If you already have Kubeflow Pipelines deployed within a cluster, you can
edit the frontend deployment YAML to specify that custom visualizations are
allowed in the same way described above. Details about updating
deployments can be found in the Kubernetes documentation about
&lt;a href=&#34;https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment&#34;&gt;updating a deployment&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Open the details of a run.&lt;/li&gt;
&lt;li&gt;Select a component.
&lt;ul&gt;
&lt;li&gt;The component that is selected does not matter. But, if you want to
visualize the output of a specific component, it is easier to do that within
that component.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Artifacts&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;At the top of the tab you should see a card named &lt;strong&gt;Visualization Creator&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Within the card, select the &lt;strong&gt;CUSTOM&lt;/strong&gt; visualization type then provide a
source, and any necessary arguments (the source and argument variables are
optional for custom visualizations).&lt;/li&gt;
&lt;li&gt;Provide the custom visualization code.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Generate Visualization&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;View generated visualization by scrolling down.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;A demo of the above instructions is as follows.&lt;/p&gt;
&lt;video width=&#34;100%&#34; max-width=&#34;100%&#34; height=&#34;auto&#34; max-height=&#34;100%&#34; controls&gt;
  &lt;source src=&#34;/docs/videos/taxi_custom_visualization.webm&#34; type=&#34;video/webm&#34;&gt;
&lt;/video&gt;
&lt;ol&gt;
&lt;li&gt;On the Pipelines page, click &lt;strong&gt;[Sample] Unified DSL - Taxi Tip Prediction Model Trainer&lt;/strong&gt; to open the Pipeline Details page.&lt;/li&gt;
&lt;li&gt;On the Pipeline Details page, click &lt;strong&gt;Create run&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the Create run page,
&lt;ul&gt;
&lt;li&gt;Use a run name and an experiment name of your choice or simply use the default names choosen for you.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;pipeline-root&lt;/strong&gt; field, specify a storage bucket that you have permission to write to. For example, enter the path to a Google Cloud Storage bucket or an Amazon S3 bucket.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Start&lt;/strong&gt; to create the run.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;After the run is complete, on the Run Details page, click the step of &lt;strong&gt;statisticsgen&lt;/strong&gt;. This step&amp;rsquo;s output is statistics data generated by Tensorflow Data Validation.&lt;/li&gt;
&lt;li&gt;In the side panel of the selected step,
&lt;ul&gt;
&lt;li&gt;Click the &lt;strong&gt;Input/Output&lt;/strong&gt; tab to find out the &lt;strong&gt;mlpipeline-ui-metadata&lt;/strong&gt; item and click the minio link there. This will open a new browser tab with information on output file path. Copy the output file path as shown in the demo video.&lt;/li&gt;
&lt;li&gt;Get back to the Run Details page, and click the &lt;strong&gt;Artifacts&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;At the top of the tab you should see a card named &lt;strong&gt;Visualization Creator&lt;/strong&gt;, choose &lt;strong&gt;Custom&lt;/strong&gt; from the drop down menu.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Custom Visualization Code&lt;/strong&gt; field, fill in the following code snippet and replace [output file path] with the output file path you just copied from &lt;strong&gt;mlpipeline-ui-metadata&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
 &lt;pre style=&#34;overflow-x:scroll;overflow-y:hidden;white-space:pre;&#34;&gt;
   import tensorflow_data_validation as tfdv
   stats = tfdv.load_statistics(&#39;[output file path]/stats_tfrecord&#39;)
   tfdv.visualize_statistics(stats)
 &lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;Generate Visualization&lt;/strong&gt; and wait.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Move to the bottom of the &lt;strong&gt;Artifacts&lt;/strong&gt; tab to find the generated visualization.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;known-limitations&#34;&gt;Known limitations&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Multiple visualizations cannot be generated concurrently.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;This is because a single Python kernel is used to generate visualizations.&lt;/li&gt;
&lt;li&gt;If visualizations are a major part of your workflow, it is recommended to
increase the number of replicas within the
&lt;a href=&#34;https://github.com/kubeflow/pipelines/tree/master/manifests/kustomize/base/pipeline/ml-pipeline-visualization-deployment.yaml&#34;&gt;visualization deployment YAML&lt;/a&gt;
file or within the visualization service deployment itself.
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Please note that this does not directly solve the issue, instead it
decreases the likelihood of experiencing delays when generating
visualizations.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Visualizations that take longer than 30 seconds will fail to generate.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For visualizations where the 30 second timeout is reached, you can add the
&lt;strong&gt;TimeoutValue&lt;/strong&gt; header to the request made by the frontend, specifying a
&lt;em&gt;positive integer as ASCII string of at most 8 digits&lt;/em&gt; for the length of
time required to generate a visualization as specified by the
&lt;a href=&#34;https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests&#34;&gt;grpc documentation&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For visualizations that take longer than 100 seconds, you will have to
specify a &lt;strong&gt;TimeoutValue&lt;/strong&gt; within the request headers &lt;strong&gt;AND&lt;/strong&gt; change the
default kernel timeout of the visualization service. To change the default
kernel timeout of the visualization service, set the &lt;strong&gt;KERNEL_TIMEOUT&lt;/strong&gt;
environment variable of the visualization service deployment to be the new
timeout length in seconds within the
&lt;a href=&#34;https://github.com/kubeflow/pipelines/tree/master/manifests/kustomize/base/pipeline/ml-pipeline-visualization-deployment.yaml&#34;&gt;visualization deployment YAML&lt;/a&gt;
file or within the visualization service deployment itself.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;- env:
  - name: KERNEL_TIMEOUT
    value: 100
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The HTML content of the generated visualizations cannot be larger than 4MB.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;gRPC by default imposes a limit of 4MB as the maximum size that can be
sent and received by a server. To allow for visualizations that are larger
than 4MB in size to be generated, you must manually set
&lt;strong&gt;MaxCallRecvMsgSize&lt;/strong&gt; for gRPC. This can be done by editing the provided
options given to the gRPC server within &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/backend/src/apiserver/main.go#L128&#34;&gt;main.go&lt;/a&gt;
to&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-golang&#34; data-lang=&#34;golang&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;maxCallRecvMsgSize&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;4&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1024&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1024&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;serviceName&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Visualization&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;// Only change the maxCallRecvMesSize if it is for visualizations
&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&lt;/span&gt;      &lt;span style=&#34;color:#000&#34;&gt;maxCallRecvMsgSize&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;50&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1024&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1024&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;opts&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[]&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;grpc&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;DialOption&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;grpc&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;WithDefaultCallOptions&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;grpc&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;MaxCallRecvMsgSize&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;maxCallRecvMsgSize&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)),&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;grpc&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;WithInsecure&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(),&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Visualize Results in the Pipelines UI</title>
      <link>/docs/pipelines/sdk/output-viewer/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/output-viewer/</guid>
      <description>
        
        
        

&lt;div class=&#34;alert alert-warning&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;Out of date&lt;/h4&gt;
This guide contains outdated information pertaining to Kubeflow 1.0. This guide
needs to be updated for Kubeflow 1.1.
&lt;/div&gt;

&lt;p&gt;This page shows you how to use the Kubeflow Pipelines UI to visualize output
from a Kubeflow Pipelines component.
For details about how to build a component, see the guide to
&lt;a href=&#34;/docs/pipelines/sdk/build-component/&#34;&gt;building your own component&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Kubeflow Pipelines provides a new method of generating visualizations. See the
guide to &lt;a href=&#34;/docs/pipelines/sdk/python-based-visualizations/&#34;&gt;Python Based Visualizations&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The Kubeflow Pipelines UI offers built-in support for several types of
visualizations, which you can use to provide rich performance evaluation and
comparison data. To make use of this programmable UI, your pipeline component
must write a JSON file to the component&amp;rsquo;s local filesystem. You can do this at
any point during the pipeline execution.&lt;/p&gt;
&lt;p&gt;You can view the output visualizations in the following places on the Kubeflow
Pipelines UI:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;strong&gt;Run output&lt;/strong&gt; tab shows the visualizations for all pipeline steps in the
selected run. To open the tab in the Kubeflow Pipelines UI:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Experiments&lt;/strong&gt; to see your current pipeline experiments.&lt;/li&gt;
&lt;li&gt;Click the &lt;em&gt;experiment name&lt;/em&gt; of the experiment that you want to view.&lt;/li&gt;
&lt;li&gt;Click the &lt;em&gt;run name&lt;/em&gt; of the run that you want to view.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Run output&lt;/strong&gt; tab.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/taxi-tip-run-output.png&#34; 
alt=&#34;Output visualization from a pipeline run&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;strong&gt;Artifacts&lt;/strong&gt; tab shows the visualization for the selected pipeline step.
To open the tab in the Kubeflow Pipelines UI:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Experiments&lt;/strong&gt; to see your current pipeline experiments.&lt;/li&gt;
&lt;li&gt;Click the &lt;em&gt;experiment name&lt;/em&gt; of the experiment that you want to view.&lt;/li&gt;
&lt;li&gt;Click the &lt;em&gt;run name&lt;/em&gt; of the run that you want to view.&lt;/li&gt;
&lt;li&gt;On the &lt;strong&gt;Graph&lt;/strong&gt; tab, click the step representing the pipeline component
that you want to view. The step details slide into view, showing the
&lt;strong&gt;Artifacts&lt;/strong&gt; tab.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/taxi-tip-prediction-step-output-table.png&#34; 
alt=&#34;Table-based visualization from a pipeline component&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All screenshots and code snippets on this page come from a
sample pipeline that you can run directly from the Kubeflow Pipelines UI.
See the &lt;a href=&#34;#example-source&#34;&gt;sample description and links below&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;writing-out-metadata-for-the-output-viewers&#34;&gt;Writing out metadata for the output viewers&lt;/h2&gt;
&lt;p&gt;The pipeline component must write a JSON file specifying metadata for the
output viewer(s) that you want to use for visualizing the results. The
component must also export a file output artifact with an artifact name of
&lt;code&gt;mlpipeline-ui-metadata&lt;/code&gt;, or else the Kubeflow Pipelines UI will not render
the visualization. In other words, the &lt;code&gt;.outputs.artifacts&lt;/code&gt; setting for the
generated pipeline component should show:
&lt;code&gt;- {name: mlpipeline-ui-metadata, path: /mlpipeline-ui-metadata.json}&lt;/code&gt;.
The JSON filepath does not matter, although &lt;code&gt;/mlpipeline-ui-metadata.json&lt;/code&gt;
is used for consistency in the examples below.&lt;/p&gt;
&lt;p&gt;The JSON specifies an array of &lt;code&gt;outputs&lt;/code&gt;. Each &lt;code&gt;outputs&lt;/code&gt; entry describes the
metadata for an output viewer. The JSON structure looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{
  &amp;quot;version&amp;quot;: 1,
  &amp;quot;outputs&amp;quot;: [
    {
      &amp;quot;type&amp;quot;: &amp;quot;confusion_matrix&amp;quot;,
      &amp;quot;format&amp;quot;: &amp;quot;csv&amp;quot;,
      &amp;quot;source&amp;quot;: &amp;quot;my-dir/my-matrix.csv&amp;quot;,
      &amp;quot;schema&amp;quot;: [
        {&amp;quot;name&amp;quot;: &amp;quot;target&amp;quot;, &amp;quot;type&amp;quot;: &amp;quot;CATEGORY&amp;quot;},
        {&amp;quot;name&amp;quot;: &amp;quot;predicted&amp;quot;, &amp;quot;type&amp;quot;: &amp;quot;CATEGORY&amp;quot;},
        {&amp;quot;name&amp;quot;: &amp;quot;count&amp;quot;, &amp;quot;type&amp;quot;: &amp;quot;NUMBER&amp;quot;},
      ],
      &amp;quot;labels&amp;quot;: &amp;quot;vocab&amp;quot;
    },
    {
      ...
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If the component writes such a file to its container filesystem, the Kubeflow
Pipelines system extracts the file, and the Kubeflow Pipelines UI uses the file
to generate the specified viewer(s). The metadata specifies where to load the
artifact data from. The Kubeflow Pipelines UI loads the data &lt;strong&gt;into memory&lt;/strong&gt;
and renders it. &lt;em&gt;Note:&lt;/em&gt; You should keep this data at a volume that&amp;rsquo;s manageable
by the UI, for example by running a sampling step before exporting the file as
an artifact.&lt;/p&gt;
&lt;p&gt;The table below shows the available metadata fields that you can specify in the
&lt;code&gt;outputs&lt;/code&gt; array. Each &lt;code&gt;outputs&lt;/code&gt; entry must have a &lt;code&gt;type&lt;/code&gt;. Depending on value of
&lt;code&gt;type&lt;/code&gt;, other fields may also be required as described in the list of output
viewers later on the page.&lt;/p&gt;
&lt;div class=&#34;table-responsive&#34;&gt;
  &lt;table class=&#34;table table-bordered&#34;&gt;
    &lt;thead class=&#34;thead-light&#34;&gt;
      &lt;tr&gt;
        &lt;th&gt;Field name&lt;/th&gt;
        &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;code&gt;format&lt;/code&gt;&lt;/td&gt;
        &lt;td&gt;The format of the artifact data. The default is &lt;code&gt;csv&lt;/code&gt;. 
          &lt;em&gt;Note:&lt;/em&gt; The only format currently available is 
          &lt;code&gt;csv&lt;/code&gt;.
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;code&gt;header&lt;/code&gt;&lt;/td&gt;
        &lt;td&gt;A list of strings to be used as headers for the artifact data. For 
          example, in a table these strings are used in the first row.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;code&gt;labels&lt;/code&gt;&lt;/td&gt;
        &lt;td&gt;A list of strings to be used as labels for artifact columns or 
          rows.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;code&gt;predicted_col&lt;/code&gt;&lt;/td&gt;
        &lt;td&gt;Name of the predicted column.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/td&gt;
        &lt;td&gt;A list of &lt;code&gt;{type, name}&lt;/code&gt; objects that specify the schema 
          of the artifact data.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;code&gt;source&lt;/code&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;The full path to the data. The available locations
          include &lt;code&gt;http&lt;/code&gt;, &lt;code&gt;https&lt;/code&gt;, 
          &lt;a href=&#34;https://aws.amazon.com/s3/&#34;&gt;Amazon S3&lt;/a&gt;, 
          &lt;a href=&#34;https://docs.minio.io/&#34;&gt;Minio&lt;/a&gt;, and 
          &lt;a href=&#34;https://cloud.google.com/storage/docs/&#34;&gt;Google Cloud 
          Storage&lt;/a&gt;.&lt;/p&gt;
          &lt;p&gt;The path can contain wildcards ‘*’, in 
          which case the Kubeflow Pipelines UI concatenates the data from the 
          matching source files.&lt;/p&gt;
          &lt;p&gt;&lt;code&gt;source&lt;/code&gt; can also contain inlined string data instead of
          a path when &lt;code&gt;storage=&#39;inline&#39;&lt;/code&gt;.&lt;/p&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;code&gt;storage&lt;/code&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;(Optional) When &lt;code&gt;storage&lt;/code&gt; is &lt;code&gt;inline&lt;/code&gt;, the value of
        &lt;code&gt;source&lt;/code&gt; is parsed as inline data instead of a path. This applies
        to all types of outputs except &lt;code&gt;tensorboard&lt;/code&gt;. See 
        &lt;a href=&#34;#markdown&#34;&gt;Markdown&lt;/a&gt; or &lt;a href=&#34;#web-app&#34;&gt;Web app&lt;/a&gt;
        below as examples.&lt;/p&gt;
        &lt;p&gt;&lt;b&gt;Be aware&lt;/b&gt;, support for inline visualizations, other than
        markdown, was introduced in Kubeflow Pipelines 0.2.5. Before using these
        visualizations, [upgrade  your Kubeflow Pipelines cluster](/docs/pipelines/upgrade/)
        to version 0.2.5 or higher.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;code&gt;target_col&lt;/code&gt;&lt;/td&gt;
        &lt;td&gt;Name of the target column.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;code&gt;type&lt;/code&gt;&lt;/td&gt;
        &lt;td&gt;Name of the viewer to be used to visualize the data. The list 
          &lt;a href=&#34;#output-types&#34;&gt;below&lt;/a&gt; shows the available types.&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a id=&#34;output-types&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;available-output-viewers&#34;&gt;Available output viewers&lt;/h2&gt;
&lt;p&gt;The sections below describe the available viewer types and the &lt;strong&gt;required&lt;/strong&gt;
metadata fields for each type.&lt;/p&gt;
&lt;h3 id=&#34;confusion-matrix&#34;&gt;Confusion matrix&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Type:&lt;/strong&gt; &lt;code&gt;confusion_matrix&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Required metadata fields:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;format&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;labels&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;source&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Optional metadata fields:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;storage&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;confusion_matrix&lt;/code&gt; viewer plots a confusion matrix visualization of the data
from the given &lt;code&gt;source&lt;/code&gt; path, using the &lt;code&gt;schema&lt;/code&gt; to parse the data. The &lt;code&gt;labels&lt;/code&gt;
provide the names of the classes to be plotted on the x and y axes.&lt;/p&gt;
&lt;p&gt;Specify &lt;code&gt;&#39;storage&#39;: &#39;inline&#39;&lt;/code&gt; to embed raw content of the
confusion matrix CSV file as a string in &lt;code&gt;source&lt;/code&gt; field directly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-Python&#34; data-lang=&#34;Python&#34;&gt;  &lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;outputs&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;confusion_matrix&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;format&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;csv&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;schema&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;target&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;CATEGORY&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;predicted&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;CATEGORY&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;count&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;NUMBER&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;],&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;source&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;CONFUSION_MATRIX_CSV_FILE&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Convert vocab to string because for bealean values we want &amp;#34;True|False&amp;#34; to match csv data.&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;labels&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;list&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87&#34;&gt;map&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;vocab&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)),&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}]&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;file_io&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;FileIO&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/mlpipeline-ui-metadata.json&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dump&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Visualization on the Kubeflow Pipelines UI:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/taxi-tip-confusion-matrix-step-output.png&#34; 
alt=&#34;Confusion matrix visualization from a pipeline component&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a id=&#34;type-markdown&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;markdown&#34;&gt;Markdown&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Type:&lt;/strong&gt; &lt;code&gt;markdown&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Required metadata fields:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;source&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Optional metadata fields:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;storage&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;markdown&lt;/code&gt; viewer renders Markdown strings on the Kubeflow Pipelines UI.
The viewer can read the Markdown data from the following locations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Markdown-formatted string embedded in the &lt;code&gt;source&lt;/code&gt; field. The value of the
&lt;code&gt;storage&lt;/code&gt; field must be &lt;code&gt;inline&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Markdown code in a remote file, at a path specified in the &lt;code&gt;source&lt;/code&gt; field.
The &lt;code&gt;storage&lt;/code&gt; field can be empty or contain any value except &lt;code&gt;inline&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-Python&#34; data-lang=&#34;Python&#34;&gt;  &lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;outputs&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Markdown that is hardcoded inline&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;storage&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;inline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;source&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;# Inline Markdown&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;[A link](https://www.kubeflow.org/)&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;markdown&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},&lt;/span&gt;
    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Markdown that is read from a file&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;source&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gs://your_project/your_bucket/your_markdown_file&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;markdown&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}]&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;file_io&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;FileIO&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/mlpipeline-ui-metadata.json&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dump&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Visualization on the Kubeflow Pipelines UI:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/markdown-output.png&#34; 
alt=&#34;Markdown visualization from a pipeline component&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;roc-curve&#34;&gt;ROC curve&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Type:&lt;/strong&gt; &lt;code&gt;roc&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Required metadata fields:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;format&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;source&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;roc&lt;/code&gt; viewer plots a receiver operating characteristic
(&lt;a href=&#34;https://en.wikipedia.org/wiki/Receiver_operating_characteristic&#34;&gt;ROC&lt;/a&gt;)
curve using the data from the given source path. The Kubeflow Pipelines UI
assumes that the schema includes three columns with the following names:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;fpr&lt;/code&gt; (false positive rate)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tpr&lt;/code&gt; (true positive rate)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;thresholds&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Optional metadata fields:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;storage&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When viewing the ROC curve, you can hover your cursor over the ROC curve to see
the threshold value used for the cursor&amp;rsquo;s closest &lt;code&gt;fpr&lt;/code&gt; and &lt;code&gt;tpr&lt;/code&gt; values.&lt;/p&gt;
&lt;p&gt;Specify &lt;code&gt;&#39;storage&#39;: &#39;inline&#39;&lt;/code&gt; to embed raw content of the ROC
curve CSV file as a string in &lt;code&gt;source&lt;/code&gt; field directly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-Python&#34; data-lang=&#34;Python&#34;&gt;  &lt;span style=&#34;color:#000&#34;&gt;df_roc&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;pd&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;DataFrame&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;({&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;fpr&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;fpr&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;tpr&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;tpr&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;thresholds&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;thresholds&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;})&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;roc_file&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;os&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;path&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;join&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;args&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;roc.csv&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;file_io&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;FileIO&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;roc_file&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;df_roc&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;to_csv&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;columns&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;fpr&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;tpr&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;thresholds&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;],&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;header&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#3465a4&#34;&gt;False&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;index&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#3465a4&#34;&gt;False&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;

  &lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;outputs&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;roc&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;format&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;csv&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;schema&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;fpr&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;NUMBER&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;tpr&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;NUMBER&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;thresholds&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;NUMBER&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;],&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;source&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;roc_file&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}]&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;file_io&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;FileIO&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/mlpipeline-ui-metadata.json&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dump&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Visualization on the Kubeflow Pipelines UI:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/taxi-tip-roc-step-output.png&#34; 
alt=&#34;ROC curve visualization from a pipeline component&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;table&#34;&gt;Table&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Type:&lt;/strong&gt; &lt;code&gt;table&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Required metadata fields:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;format&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;header&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;source&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Optional metadata fields:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;storage&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;table&lt;/code&gt; viewer builds an HTML table out of the data at the given &lt;code&gt;source&lt;/code&gt;
path, where the &lt;code&gt;header&lt;/code&gt; field specifies the values to be shown in the first row
of the table. The table supports pagination.&lt;/p&gt;
&lt;p&gt;Specify &lt;code&gt;&#39;storage&#39;: &#39;inline&#39;&lt;/code&gt; to embed CSV table content string
in &lt;code&gt;source&lt;/code&gt; field directly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-Python&#34; data-lang=&#34;Python&#34;&gt;  &lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;outputs&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;table&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;storage&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gcs&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;format&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;csv&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;header&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;x&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;for&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;x&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;in&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;schema&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;],&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;source&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;prediction_results&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}]&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;open&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/mlpipeline-ui-metadata.json&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dump&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Visualization on the Kubeflow Pipelines UI:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/taxi-tip-prediction-step-output-table.png&#34; 
alt=&#34;Table-based visualization from a pipeline component&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;tensorboard&#34;&gt;TensorBoard&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Type:&lt;/strong&gt; &lt;code&gt;tensorboard&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Required metadata Fields:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;source&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;tensorboard&lt;/code&gt; viewer adds a &lt;strong&gt;Start Tensorboard&lt;/strong&gt; button to the output page.&lt;/p&gt;
&lt;p&gt;When viewing the output page, you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;Start Tensorboard&lt;/strong&gt; to start a
&lt;a href=&#34;https://www.tensorflow.org/guide/summaries_and_tensorboard&#34;&gt;TensorBoard&lt;/a&gt; Pod
in your Kubeflow cluster. The button text switches to &lt;strong&gt;Open Tensorboard&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Open Tensorboard&lt;/strong&gt; to open the TensorBoard interface in a new tab,
pointing to the logdir data specified in the &lt;code&gt;source&lt;/code&gt; field.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Delete Tensorboard&lt;/strong&gt; to shutdown the Tensorboard instance.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The Kubeflow Pipelines UI doesn&amp;rsquo;t fully manage your TensorBoard
instances. The &amp;ldquo;Start Tensorboard&amp;rdquo; button is a convenience feature so that
you don&amp;rsquo;t have to interrupt your workflow when looking at pipeline runs. You&amp;rsquo;re
responsible for recycling or deleting the TensorBoard Pods using your Kubernetes
management tools.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-Python&#34; data-lang=&#34;Python&#34;&gt;  &lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;outputs&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;tensorboard&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;source&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;args&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;job_dir&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}]&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;open&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/mlpipeline-ui-metadata.json&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dump&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Visualization on the Kubeflow Pipelines UI:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/taxi-tip-training-step-output-tensorboard.png&#34; 
alt=&#34;TensorBoard option output from a pipeline component&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;web-app&#34;&gt;Web app&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Type:&lt;/strong&gt; &lt;code&gt;web-app&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Required metadata fields:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;source&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Optional metadata fields:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;storage&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;web-app&lt;/code&gt; viewer provides flexibility for rendering custom output. You can
specify an HTML file that your component creates, and the Kubeflow Pipelines UI
renders that HTML in the output page. The HTML file must be self-contained, with
no references to other files in the filesystem. The HTML file can contain
absolute references to files on the web. Content running inside the web app is
sandboxed in an iframe and cannot communicate with the Kubeflow Pipelines UI.&lt;/p&gt;
&lt;p&gt;Specify &lt;code&gt;&#39;storage&#39;: &#39;inline&#39;&lt;/code&gt; to embed raw html in &lt;code&gt;source&lt;/code&gt; field directly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-Python&#34; data-lang=&#34;Python&#34;&gt;  &lt;span style=&#34;color:#000&#34;&gt;static_html_path&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;os&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;path&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;join&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output_dir&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;_OUTPUT_HTML_FILE&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;file_io&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;write_string_to_file&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;static_html_path&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;rendered_template&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;

  &lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;outputs&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;web-app&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;storage&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gcs&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;source&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;static_html_path&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;web-app&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;storage&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;inline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;source&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;&amp;lt;h1&amp;gt;Hello, World!&amp;lt;/h1&amp;gt;&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}]&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;file_io&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;FileIO&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/mlpipeline-ui-metadata.json&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dump&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;metadata&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Visualization on the Kubeflow Pipelines UI:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/taxi-tip-analysis-step-output-webapp-popped-out.png&#34; 
alt=&#34;Web app output from a pipeline component&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a id=&#34;example-source&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;source-of-examples-on-this-page&#34;&gt;Source of examples on this page&lt;/h2&gt;
&lt;p&gt;The above examples come from the &lt;em&gt;tax tip prediction&lt;/em&gt; sample that is
pre-installed when you deploy Kubeflow.&lt;/p&gt;
&lt;p&gt;You can run the sample by selecting
&lt;strong&gt;[Sample] ML - TFX - Taxi Tip Prediction Model Trainer&lt;/strong&gt; from the
Kubeflow Pipelines UI. For help getting started with the UI, follow the
&lt;a href=&#34;/docs/pipelines/pipelines-quickstart/&#34;&gt;Kubeflow Pipelines quickstart&lt;/a&gt;.&lt;/p&gt;
&lt;!--- TODO: Will replace the tfx cab with tfx oss when it is ready.--&gt;
&lt;p&gt;The pipeline uses a number of prebuilt, reusable components, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/components/local/confusion_matrix/src/confusion_matrix.py&#34;&gt;Confusion Matrix
component&lt;/a&gt;
which writes out the data for the &lt;code&gt;confusion_matrix&lt;/code&gt; viewer.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/components/local/roc/src/roc.py&#34;&gt;ROC
component&lt;/a&gt;
which writes out the data for the &lt;code&gt;roc&lt;/code&gt; viewer.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/components/kubeflow/dnntrainer/src/trainer/task.py&#34;&gt;dnntrainer
component&lt;/a&gt;
which writes out the data for the &lt;code&gt;tensorboard&lt;/code&gt; viewer.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/components/dataflow/tfma/src/model_analysis.py&#34;&gt;tfma
component&lt;/a&gt;
which writes out the data for the &lt;code&gt;web-app&lt;/code&gt; viewer.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/components/dataflow/predict/src/predict.py&#34;&gt;dataflow predict
component&lt;/a&gt;
which writes out the data for the &lt;code&gt;table&lt;/code&gt; viewer.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;usage-in-lightweight-python-components&#34;&gt;Usage in lightweight python components&lt;/h2&gt;
&lt;p&gt;For lightweight components, the syntax is slightly different. You can refer to
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/lightweight_component/lightweight_component.ipynb&#34;&gt;the lightweight python component notebook example&lt;/a&gt; to learn more about declaring output visualizations.&lt;/p&gt;
&lt;h2 id=&#34;next-step&#34;&gt;Next step&lt;/h2&gt;
&lt;p&gt;See how to &lt;a href=&#34;/docs/pipelines/metrics/pipelines-metrics/&#34;&gt;export metrics from your
pipeline&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Pipeline Metrics</title>
      <link>/docs/pipelines/sdk/pipelines-metrics/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/pipelines-metrics/</guid>
      <description>
        
        
        &lt;p&gt;This page shows you how to export metrics from a Kubeflow Pipelines component.
For details about how to build a component, see the guide to
&lt;a href=&#34;/docs/pipelines/sdk/component-development/&#34;&gt;building your own component&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;overview-of-metrics&#34;&gt;Overview of metrics&lt;/h2&gt;
&lt;p&gt;Kubeflow Pipelines supports the export of scalar metrics. You can write a list
of metrics to a local file to describe the performance of the model. The
pipeline agent uploads the local file as your run-time metrics. You can view the
uploaded metrics as a visualization in the &lt;strong&gt;Runs&lt;/strong&gt; page for a particular
experiment in the Kubeflow Pipelines UI.&lt;/p&gt;
&lt;h2 id=&#34;export-the-metrics-dictionary&#34;&gt;Export the metrics dictionary&lt;/h2&gt;
&lt;p&gt;To enable metrics, your component must have an output called &lt;code&gt;MLPipeline Metrics&lt;/code&gt; and return a JSON-serialized metrics dictionary.
Otherwise the Kubeflow Pipelines UI will
not render the visualization. In other words, the &lt;code&gt;.outputs.artifacts&lt;/code&gt; setting
for the generated pipeline template should show:
&lt;code&gt;- {name: mlpipeline-metrics, path: /tmp/outputs/mlpipeline_metrics/data}&lt;/code&gt;.
(The file path does not matter.)&lt;/p&gt;
&lt;p&gt;An example Lightweight python component that outputs metrics dictionary by writing it to an output file:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-Python&#34; data-lang=&#34;Python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp.components&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;InputPath&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;OutputPath&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;create_component_from_func&lt;/span&gt;

&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;produce_metrics&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Note when the `create_component_from_func` method converts the function to a component, the function parameter &amp;#34;mlpipeline_metrics_path&amp;#34; becomes an output with name &amp;#34;mlpipeline_metrics&amp;#34; which is the correct name for metrics output.&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;mlpipeline_metrics_path&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;OutputPath&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;

  &lt;span style=&#34;color:#000&#34;&gt;accuracy&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0.9&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;metrics&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;accuracy-score&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# The name of the metric. Visualized as the column name in the runs table.&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;numberValue&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;  &lt;span style=&#34;color:#000&#34;&gt;accuracy&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# The value of the metric. Must be a numeric value.&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;format&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;PERCENTAGE&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;   &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# The optional format of the metric. Supported values are &amp;#34;RAW&amp;#34; (displayed in raw format) and &amp;#34;PERCENTAGE&amp;#34; (displayed in percentage format).&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}]&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#204a87&#34;&gt;open&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;mlpipeline_metrics_path&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dump&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;metrics&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;

&lt;span style=&#34;color:#000&#34;&gt;produce_metrics_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;create_component_from_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;produce_metrics&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;base_image&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;python:3.7&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;packages_to_install&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[],&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;output_component_file&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;component.yaml&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here&amp;rsquo;s an example of a lightweight Python component that outputs a metrics dictionary by returning it from the function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-Python&#34; data-lang=&#34;Python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;typing&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;NamedTuple&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp.components&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;InputPath&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;OutputPath&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;create_component_from_func&lt;/span&gt;

&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;produce_metrics&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;NamedTuple&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Outputs&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;mlpipeline_metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;),&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]):&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;

  &lt;span style=&#34;color:#000&#34;&gt;accuracy&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0.9&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;metrics&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;metrics&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[{&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;accuracy-score&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# The name of the metric. Visualized as the column name in the runs table.&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;numberValue&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;  &lt;span style=&#34;color:#000&#34;&gt;accuracy&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# The value of the metric. Must be a numeric value.&lt;/span&gt;
      &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;format&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;PERCENTAGE&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;   &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# The optional format of the metric. Supported values are &amp;#34;RAW&amp;#34; (displayed in raw format) and &amp;#34;PERCENTAGE&amp;#34; (displayed in percentage format).&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}]&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;json&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dumps&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;metrics&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)]&lt;/span&gt;

&lt;span style=&#34;color:#000&#34;&gt;produce_metrics_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;create_component_from_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;produce_metrics&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;base_image&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;python:3.7&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;packages_to_install&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[],&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;output_component_file&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;component.yaml&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;An example script-based &lt;code&gt;component.yaml&lt;/code&gt; component:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Produce metrics&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;outputs&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;- {&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;name: MLPipeline Metrics, type&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Metrics}&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;implementation&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;container&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;image&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;alpine&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;command&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#000&#34;&gt;sh&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- -&lt;span style=&#34;color:#000&#34;&gt;exc&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;|&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;      output_metrics_path=$0
&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;      mkdir -p &amp;#34;$(dirname &amp;#34;$output_metrics_path&amp;#34;)&amp;#34;
&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;      echo &amp;#39;{
&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;        &amp;#34;metrics&amp;#34;: [{
&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;          &amp;#34;name&amp;#34;: &amp;#34;accuracy-score&amp;#34;,
&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;          &amp;#34;numberValue&amp;#34;: 0.8,
&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;          &amp;#34;format&amp;#34;: &amp;#34;PERCENTAGE&amp;#34;
&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;        }]
&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;      }&amp;#39; &amp;gt; &amp;#34;$output_metrics_path&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;      
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- {&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;outputPath&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;MLPipeline Metrics}&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Refer to the &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/components/local/confusion_matrix/src/confusion_matrix.py&#34;&gt;full example&lt;/a&gt; of a component that generates a confusion matrix data from prediction results.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The output name must be &lt;code&gt;MLPipeline Metrics&lt;/code&gt; or &lt;code&gt;MLPipeline_Metrics&lt;/code&gt; (case does not matter).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;name&lt;/code&gt; of each metric must match the following pattern: &lt;code&gt;^[a-zA-Z]([-_a-zA-Z0-9]{0,62}[a-zA-Z0-9])?$&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For Kubeflow Pipelines version 0.5.1 or earlier, name must match the following pattern &lt;code&gt;^[a-z]([-a-z0-9]{0,62}[a-z0-9])?$&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;numberValue&lt;/code&gt; must be a numeric value.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;format&lt;/code&gt; can only be &lt;code&gt;PERCENTAGE&lt;/code&gt;, &lt;code&gt;RAW&lt;/code&gt;, or not set.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;view-the-metrics&#34;&gt;View the metrics&lt;/h2&gt;
&lt;p&gt;To see a visualization of the metrics:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Experiments&lt;/strong&gt; page in the Kubeflow Pipelines UI.&lt;/li&gt;
&lt;li&gt;Click one of your experiments. The &lt;strong&gt;Runs&lt;/strong&gt; page opens showing the top two
metrics, where &lt;em&gt;top&lt;/em&gt; is determined by prevalence (that is, the metrics with
the highest count) and then by metric name.
The metrics appear as columns for each run.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following example shows the &lt;strong&gt;accuracy-score&lt;/strong&gt; and
&lt;strong&gt;roc-auc-score&lt;/strong&gt; metrics for two runs within an experiment:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/docs/images/taxi-tip-run-scores.png&#34; 
alt=&#34;Metrics from a pipeline run&#34;
class=&#34;mt-3 mb-3 border border-info rounded&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;next-step&#34;&gt;Next step&lt;/h2&gt;
&lt;p&gt;Visualize the output of your component by &lt;a href=&#34;/docs/pipelines/metrics/output-viewer/&#34;&gt;writing out metadata for an output
viewer&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: DSL Static Type Checking</title>
      <link>/docs/pipelines/sdk/static-type-checking/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/static-type-checking/</guid>
      <description>
        
        
        &lt;p&gt;This page describes how to integrate the type information in the pipeline and utilize the
static type checking for fast development iterations.&lt;/p&gt;
&lt;h2 id=&#34;motivation&#34;&gt;Motivation&lt;/h2&gt;
&lt;p&gt;A pipeline is a workflow consisting of &lt;a href=&#34;/docs/pipelines/sdk/build-component#overview-of-pipelines-and-components&#34;&gt;components&lt;/a&gt; and each
component contains inputs and outputs. The DSL compiler supports static type checking to ensure the type consistency among the component
I/Os within the same pipeline. Static type checking helps you to identify component I/O inconsistencies without running the pipeline.
It also shortens the development cycles by catching the errors early.
This feature is especially useful in two cases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When the pipeline is huge and manually checking the types is infeasible;&lt;/li&gt;
&lt;li&gt;When some components are shared ones and the type information is not immediately available.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;type-system&#34;&gt;Type system&lt;/h2&gt;
&lt;p&gt;In Kubeflow pipeline, a type is defined as a type name with an &lt;a href=&#34;https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md&#34;&gt;OpenAPI Schema&lt;/a&gt;
property, which defines the input parameter schema. &lt;strong&gt;Warning&lt;/strong&gt;: the pipeline system
currently does not check the input value against the schema when you submit a pipeline run. However, this feature will come in the near
future.&lt;/p&gt;
&lt;p&gt;There is a set of &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/dsl/types.py&#34;&gt;core types&lt;/a&gt; defined in the
pipeline SDK and you can use these core types or define your custom types.&lt;/p&gt;
&lt;p&gt;In the component YAML, types are specified as a string or a dictionary with the OpenAPI Schema, as illustrated below.
&amp;ldquo;&lt;em&gt;component a&lt;/em&gt;&amp;rdquo; expects an input with Integer type and emits three outputs with the type GCSPath, customized_type and GCRPath.
Among these types, Integer, GCSPath, and GCRPath are core types that are predefined in the SDK while customized_type is a user-defined
type.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;component a&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;component desc&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;inputs&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;- {&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;name: field_l, type&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Integer}&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;outputs&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;- {&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;name: field_m, type&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;GCSPath&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;openapi_schema_validator&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;type: string, pattern&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;^gs://.*$&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;}&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;}}}&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;- {&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;name: field_n, type&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;customized_type}&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;- {&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;name: field_o, type&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;GCRPath} &lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;implementation&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;container&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;image&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;gcr.io/ml-pipeline/component-a&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;command&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;python3, /pipelines/component/src/train.py]&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;args&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;      &lt;/span&gt;--&lt;span style=&#34;color:#000&#34;&gt;field-l, {inputValue: field_l},&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;fileOutputs&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; 
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;field_m&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;/schema.txt&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;field_n&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;/feature.txt&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;field_o&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;/output.txt&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Similarly, when you write a component with the decorator, you can annotate I/O with types in the function signature, as shown below.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp.dsl&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;component&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp.dsl.types&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Integer&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;GCRPath&lt;/span&gt;


&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@component&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;field_l&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Integer&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;())&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;field_m&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;GCSPath&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;openapi_schema_validator&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
                &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;{&amp;#34;type&amp;#34;: &amp;#34;string&amp;#34;, &amp;#34;pattern&amp;#34;: &amp;#34;^gs://.*$&amp;#34;}&amp;#39;&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;field_n&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;customized_type&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;field_o&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;GCRPath&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}:&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;ContainerOp&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;operator a&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;image&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gcr.io/ml-pipeline/component-a&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;command&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;python3&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/pipelines/component/src/train.py&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;],&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
          &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--field-l&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
          &lt;span style=&#34;color:#000&#34;&gt;field_l&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;],&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;file_outputs&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
          &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;field_m&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/schema.txt&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
          &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;field_n&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/feature.txt&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
          &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;field_o&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;/output.txt&amp;#39;&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can also annotate pipeline inputs with types and the input are checked against the component I/O types as well. For example,&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@component&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;field_m&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;GCSPath&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;openapi_schema_validator&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
                &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;{&amp;#34;type&amp;#34;: &amp;#34;string&amp;#34;, &amp;#34;pattern&amp;#34;: &amp;#34;^gs://.*$&amp;#34;}&amp;#39;&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;},&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;field_o&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Integer&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;ContainerOp&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;operator a&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;image&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;gcr.io/ml-pipeline/component-a&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
          &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--field-l&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
          &lt;span style=&#34;color:#000&#34;&gt;field_m&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
          &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;--field-o&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
          &lt;span style=&#34;color:#000&#34;&gt;field_o&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
      &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;],&lt;/span&gt;
  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;


&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Pipeline input types are also checked against the component I/O types.&lt;/span&gt;
&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type_check&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;GCSPath&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;openapi_schema_validator&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
                &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;{&amp;#34;type&amp;#34;: &amp;#34;string&amp;#34;, &amp;#34;pattern&amp;#34;: &amp;#34;^gs://.*$&amp;#34;}&amp;#39;&lt;/span&gt;
        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;good&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Integer&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;12&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;task_factory_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;field_m&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;field_o&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;


&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;try&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;compiler&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Compiler&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;compile&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;pipeline.tar.gz&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;type_check&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#3465a4&#34;&gt;True&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;except&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;InconsistentTypeException&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;e&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;print&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;e&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;how-does-the-type-checking-work&#34;&gt;How does the type checking work?&lt;/h2&gt;
&lt;p&gt;The basic checking criterion is the equality checking. In other words, type checking passes only when the type name strings are equal
and the corresponding OpenAPI Schema properties are equal. Examples of type checking failure are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;ldquo;GCSPath&amp;rdquo; vs. &amp;ldquo;GCRPath&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;Integer&amp;rdquo; vs. &amp;ldquo;Float&amp;rdquo;&lt;/li&gt;
&lt;li&gt;{&amp;lsquo;GCSPath&amp;rsquo;: {&amp;lsquo;openapi_schema_validator&amp;rsquo;: &amp;lsquo;{&amp;ldquo;type&amp;rdquo;: &amp;ldquo;string&amp;rdquo;, &amp;ldquo;pattern&amp;rdquo;: &amp;ldquo;^gs://.&lt;em&gt;$&amp;quot;}&#39;}} vs.&lt;br&gt;
{&amp;lsquo;GCSPath&amp;rsquo;: {&amp;lsquo;openapi_schema_validator&amp;rsquo;: &amp;lsquo;{&amp;ldquo;type&amp;rdquo;: &amp;ldquo;string&amp;rdquo;, &amp;ldquo;pattern&amp;rdquo;: &amp;ldquo;^gcs://.&lt;/em&gt;$&amp;quot;}&#39;}}&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If inconsistent types are detected, it throws an &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/dsl/types.py&#34;&gt;InconsistentTypeException&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;type-checking-configuration&#34;&gt;Type checking configuration&lt;/h2&gt;
&lt;p&gt;Type checking is enabled by default and it can be disabled in two ways:&lt;/p&gt;
&lt;p&gt;If you compile the pipeline programmably:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;compiler&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Compiler&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;compile&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;pipeline_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;pipeline_a.tar.gz&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;type_check&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#3465a4&#34;&gt;False&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you compile the pipeline using the dsl-compiler tool:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;dsl-compiler --py pipeline.py --output pipeline.zip --disable-type-check
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;fine-grained-configuration&#34;&gt;Fine-grained configuration&lt;/h3&gt;
&lt;p&gt;Sometimes, you might want to enable the type checking but disable certain arguments. For example,
when the upstream component generates an output with type &amp;ldquo;&lt;em&gt;Float&lt;/em&gt;&amp;rdquo; and the downstream can ingest either
&amp;ldquo;&lt;em&gt;Float&lt;/em&gt;&amp;rdquo; or &amp;ldquo;&lt;em&gt;Integer&lt;/em&gt;&amp;rdquo;, it might fail if you define the type as &amp;ldquo;&lt;em&gt;Float_or_Integer&lt;/em&gt;&amp;rdquo;.
Disabling the type checking per-argument is also supported as shown below.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;type_check_a&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;():&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;field_l&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;12&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# For each of the arguments, you can also ignore the types by calling&lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# ignore_type function.&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;b&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;field_x&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;outputs&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;field_n&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;],&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;field_y&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;outputs&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;field_o&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;],&lt;/span&gt;
      &lt;span style=&#34;color:#000&#34;&gt;field_z&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;outputs&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;field_m&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;ignore_type&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;())&lt;/span&gt;

&lt;span style=&#34;color:#000&#34;&gt;compiler&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Compiler&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;compile&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;pipeline.tar.gz&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;type_check&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#3465a4&#34;&gt;True&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;missing-types&#34;&gt;Missing types&lt;/h3&gt;
&lt;p&gt;DSL compiler passes the type checking if either of the upstream or the downstream components lack the type information for some parameters.
The effects are the same as that of ignoring the type information. However,
type checking would still fail if some I/Os lack the type information and some I/O types are incompatible.&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;p&gt;Learn how to define a KubeFlow pipeline with Python DSL and compile the
pipeline with type checking: a
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/dsl_static_type_checking/dsl_static_type_checking.ipynb&#34;&gt;Jupyter notebook demo&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: DSL Recursion</title>
      <link>/docs/pipelines/sdk/dsl-recursion/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/dsl-recursion/</guid>
      <description>
        
        
        

&lt;div class=&#34;alert alert-warning&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;Out of date&lt;/h4&gt;
This guide contains outdated information pertaining to Kubeflow 1.0. This guide
needs to be updated for Kubeflow 1.1.
&lt;/div&gt;

&lt;p&gt;This page describes how to write recursive functions in the domain specific language (DSL) provided by the Kubeflow Pipelines SDK.&lt;/p&gt;
&lt;h2 id=&#34;motivation&#34;&gt;Motivation&lt;/h2&gt;
&lt;p&gt;Recursion is a feature that is supported by almost all languages to express complex semantics in a succinct way.
In machine learning workflows, recursions are especially important to enable features such as multiple rounds of training,
iterative model analysis, and hypertuning. The recursion support also covers the loop feature since it enables the same code
block to be executed and exited based on dynamic conditions.&lt;/p&gt;
&lt;h2 id=&#34;how-to-write-a-recursive-function&#34;&gt;How to write a recursive function&lt;/h2&gt;
&lt;h3 id=&#34;decorator&#34;&gt;Decorator&lt;/h3&gt;
&lt;p&gt;Decorate the recursive function with &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/dsl/_component.py&#34;&gt;kfp.dsl.graph_component&lt;/a&gt;
as illustrated below. The decorator does not require any arguments.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp.dsl&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;
&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@dsl.graph_component&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;graph_component_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;input_x&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Condition&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;input_x&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;value_x&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;op_a&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;input_x&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;op_b&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;after&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;op_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;graph_component_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;op_b&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
    
&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;shows how to use the recursion.&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;():&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;op_a&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;op_b&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;graph_op_a&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;graph_component_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;op_a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;graph_op_a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;after&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;op_b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;task_factory_c&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;op_a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;after&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;graph_op_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;function-signature&#34;&gt;Function signature&lt;/h3&gt;
&lt;p&gt;Define the function signature as a standard Python function. The input parameters are &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/dsl/_pipeline_param.py&#34;&gt;PipelineParams&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;function-body&#34;&gt;Function body&lt;/h3&gt;
&lt;p&gt;Similar to the pipeline function body, you can instantiate components, create &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/f8b0f5bf0cc0b5aceb8aedfd21e93156e363ea48/sdk/python/kfp/dsl/_ops_group.py#L110&#34;&gt;conditions&lt;/a&gt;,
use the input parameters from the function signature, and specify dependencies explicitly among components.
In the example above, one condition is created inside the recursive function and
two components &lt;em&gt;op_a&lt;/em&gt; and &lt;em&gt;op_b&lt;/em&gt; are created inside the condition.&lt;/p&gt;
&lt;h3 id=&#34;call-the-recursive-function-in-the-pipeline-function&#34;&gt;Call the recursive function in the pipeline function&lt;/h3&gt;
&lt;p&gt;You can pass pipeline/component output to the recursive function and specify the dependencies explicitly with &lt;em&gt;after()&lt;/em&gt; function, similar to
the &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/dsl/_container_op.py&#34;&gt;ContainerOp&lt;/a&gt;. In the example above, the output of &lt;em&gt;op_a&lt;/em&gt;
defined in the pipeline is passed to the recursive function and the &lt;em&gt;task_factory_c&lt;/em&gt; component is specified to depend on the &lt;em&gt;graph_op_a&lt;/em&gt;.
The recursive function can also be explicitly specified to depend on the ContainerOps. For example, &lt;em&gt;graph_op_a&lt;/em&gt; depends on &lt;em&gt;op_b&lt;/em&gt; in the pipeline.&lt;/p&gt;
&lt;h3 id=&#34;more-examples&#34;&gt;More examples&lt;/h3&gt;
&lt;p&gt;Here is another example where the recursive function call is at the end of the function body, similar to &lt;a href=&#34;https://en.wikipedia.org/wiki/Do_while_loop&#34;&gt;do-while&lt;/a&gt; loops.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp.dsl&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;
&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@dsl.graph_component&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;graph_component_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;input_x&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;op_a&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;input_x&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;op_b&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;after&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;op_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;with&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Condition&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;op_b&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;value_x&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;):&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;graph_component_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;op_b&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
 
&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;pipeline&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;shows how to use the recursion.&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;():&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;op_a&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;op_b&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;task_factory_b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;graph_op_a&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;graph_component_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;op_a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;graph_op_a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;after&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;op_b&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;task_factory_c&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;op_a&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;after&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;graph_op_a&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;limitations&#34;&gt;Limitations&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;/docs/pipelines/sdk/static-type-checking&#34;&gt;Type checking&lt;/a&gt; does not work for the recursive functions. In other words, The type information that is annotated to the recursive
function signature will not be checked.&lt;/li&gt;
&lt;li&gt;Since the output of the recursive functions cannot be dynamically resolved, the downstream ContainerOps cannot
access the output from the recursive functions.&lt;/li&gt;
&lt;li&gt;A known &lt;a href=&#34;https://github.com/kubeflow/pipelines/issues/1065&#34;&gt;issue&lt;/a&gt; is that the recursion fails to work when there are
multiple recursive function calls in the function body.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;See &lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/recursion/recursion.py&#34;&gt;recursion sample&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Using environment variables in pipelines</title>
      <link>/docs/pipelines/sdk/enviroment_variables/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/enviroment_variables/</guid>
      <description>
        
        
        

&lt;div class=&#34;alert alert-warning&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;Out of date&lt;/h4&gt;
This guide contains outdated information pertaining to Kubeflow 1.0. This guide
needs to be updated for Kubeflow 1.1.
&lt;/div&gt;

&lt;p&gt;This page describes how to pass environment variables to Kubeflow pipeline
components.&lt;/p&gt;
&lt;h2 id=&#34;before-you-start&#34;&gt;Before you start&lt;/h2&gt;
&lt;p&gt;Set up your environment:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;/docs/started/getting-started/&#34;&gt;Install Kubeflow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/pipelines/sdk/install-sdk/&#34;&gt;Install the Kubeflow Pipelines SDK&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;using-environment-variables&#34;&gt;Using environment variables&lt;/h2&gt;
&lt;p&gt;In this example, you pass an environment variable to a lightweight Python
component, which writes the variable&amp;rsquo;s value to the log.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;/docs/pipelines/sdk/lightweight-python-components/&#34;&gt;Learn more about lightweight Python components&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To build a component, define a stand-alone Python function and then call
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.components.html#kfp.components.func_to_container_op&#34;&gt;kfp.components.func_to_container_op(func)&lt;/a&gt; to convert the
function to a component that can be used in a pipeline. The following function gets an
environment variable and writes it to the log.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;logg_env_function&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;():&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;os&lt;/span&gt;
  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;logging&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;logging&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;basicConfig&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;level&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;logging&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;INFO&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;env_variable&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;os&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;getenv&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;example_env&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;logging&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;info&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;The environment variable is: {}&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;format&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;env_variable&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Transform the function into a component using
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.components.html#kfp.components.func_to_container_op&#34;&gt;kfp.components.func_to_container_op(func)&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;image_name&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;tensorflow/tensorflow:1.11.0-py3&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;logg_env_function_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;comp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;func_to_container_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;logg_env_function&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
                                                 &lt;span style=&#34;color:#000&#34;&gt;base_image&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;image_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add this component to a pipeline. Use &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ContainerOp.container&#34;&gt;add_env_variable&lt;/a&gt; to pass an
environment variable into the component. This code is the same no matter if your
using python lightweight components or a &lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ContainerOp&#34;&gt;container operation&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp.dsl&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;as&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kubernetes.client.models&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;V1EnvVar&lt;/span&gt;

&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@dsl.pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;Env example&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;description&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;A pipeline showing how to use environment variables&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;environment_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;():&lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;env_var&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;V1EnvVar&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;example_env&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;value&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;env_variable&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#Returns a dsl.ContainerOp class instance. &lt;/span&gt;
  &lt;span style=&#34;color:#000&#34;&gt;container_op&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;logg_env_function_op&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;add_env_variable&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;env_var&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To pass more environment variables into a component, add more instances of
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ContainerOp.container&#34;&gt;add_env_variable()&lt;/a&gt;. Use the following command to run this pipeline using the
Kubeflow Pipelines SDK.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#Specify pipeline argument values&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{}&lt;/span&gt;

&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#Submit a pipeline run&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Client&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;create_run_from_pipeline_func&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;environment_pipeline&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
                                           &lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;arguments&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
    </item>
    
    <item>
      <title>Docs: GCP-specific Uses of the SDK</title>
      <link>/docs/pipelines/sdk/gcp/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/gcp/</guid>
      <description>
        
        
        &lt;p&gt;For pipeline features that are specific to GCP, including SDK features, see the
&lt;a href=&#34;/docs/gke/pipelines/&#34;&gt;GCP section of the docs&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Manipulate Kubernetes Resources as Part of a Pipeline</title>
      <link>/docs/pipelines/sdk/manipulate-resources/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/manipulate-resources/</guid>
      <description>
        
        
        

&lt;div class=&#34;alert alert-warning&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;Out of date&lt;/h4&gt;
This guide contains outdated information pertaining to Kubeflow 1.0. This guide
needs to be updated for Kubeflow 1.1.
&lt;/div&gt;

&lt;p&gt;This page describes how to manipulate Kubernetes resources through individual
Kubeflow Pipelines components during a pipeline.
Users may handle any Kubernetes resource, while creating
&lt;a href=&#34;https://kubernetes.io/docs/concepts/storage/persistent-volumes/&#34;&gt;Persistent Volume Claims&lt;/a&gt;
and
&lt;a href=&#34;https://kubernetes.io/docs/concepts/storage/volume-snapshots/&#34;&gt;Volume Snapshots&lt;/a&gt;
is rendered easy in the common case.&lt;/p&gt;
&lt;h2 id=&#34;kubernetes-resources&#34;&gt;Kubernetes Resources&lt;/h2&gt;
&lt;h3 id=&#34;resourceop&#34;&gt;ResourceOp&lt;/h3&gt;
&lt;p&gt;This class represents a step of the pipeline which manipulates Kubernetes resources.
It implements
&lt;a href=&#34;https://github.com/argoproj/argo/tree/master/examples#kubernetes-resources&#34;&gt;Argo&amp;rsquo;s resource template&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This feature allows users to perform some action (&lt;code&gt;get&lt;/code&gt;, &lt;code&gt;create&lt;/code&gt;, &lt;code&gt;apply&lt;/code&gt;,
&lt;code&gt;delete&lt;/code&gt;, &lt;code&gt;replace&lt;/code&gt;, &lt;code&gt;patch&lt;/code&gt;) on Kubernetes resources.
Users are able to set conditions that denote the success or failure of the
step undertaking that action.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ResourceOp&#34;&gt;Link&lt;/a&gt;
to the corresponding Python library.&lt;/p&gt;
&lt;h4 id=&#34;arguments&#34;&gt;Arguments&lt;/h4&gt;
&lt;p&gt;Only most significant arguments are presented in this section.
For more information, please refer to the aforementioned link to the library.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;k8s_resource&lt;/code&gt;: Definition of the Kubernetes resource.
(&lt;em&gt;required&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;action&lt;/code&gt;: Action to be performed (defaults to &lt;code&gt;create&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;merge_strategy&lt;/code&gt;: Merge strategy when action is &lt;code&gt;patch&lt;/code&gt;.
(&lt;em&gt;optional&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;success_condition&lt;/code&gt;: Condition to denote success of the step once it is true.
(&lt;em&gt;optional&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;failure_condition&lt;/code&gt;: Condition to denote failure of the step once it is true.
(&lt;em&gt;optional&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;attribute_outputs&lt;/code&gt;: Similar to &lt;code&gt;file_outputs&lt;/code&gt; of
&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.ContainerOp&#34;&gt;&lt;code&gt;kfp.dsl.ContainerOp&lt;/code&gt;&lt;/a&gt;.
Maps output parameter names to JSON paths in the Kubernetes object.
More on that in the following section.
(&lt;em&gt;optional&lt;/em&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;outputs&#34;&gt;Outputs&lt;/h4&gt;
&lt;p&gt;ResourceOps can produce output parameters.
They can output field values of the resource which is being manipulated.
For example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;job&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kubernetes_client&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;V1Job&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;

&lt;span style=&#34;color:#000&#34;&gt;rop&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;kfp&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;ResourceOp&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;create-job&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;k8s_resource&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;job&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;action&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;create&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;attribute_outputs&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;{.metadata.name}&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;By default, ResourceOps output the resource&amp;rsquo;s name as well as the whole resource
specification.&lt;/p&gt;
&lt;h3 id=&#34;samples&#34;&gt;Samples&lt;/h3&gt;
&lt;p&gt;For better understanding, please refer to the following samples:
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/resource_ops/resource_ops.py&#34;&gt;1&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;persistent-volume-claims-pvcs&#34;&gt;Persistent Volume Claims (PVCs)&lt;/h2&gt;
&lt;p&gt;Request the creation of PVC instances simple and fast.&lt;/p&gt;
&lt;h3 id=&#34;volumeop&#34;&gt;VolumeOp&lt;/h3&gt;
&lt;p&gt;A ResourceOp specialized in PVC creation.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.VolumeOp&#34;&gt;Link&lt;/a&gt;
to the corresponding Python library.&lt;/p&gt;
&lt;h4 id=&#34;arguments-1&#34;&gt;Arguments&lt;/h4&gt;
&lt;p&gt;The following arguments are an extension to &lt;code&gt;ResourceOp&lt;/code&gt; arguments.
If a &lt;code&gt;k8s_resource&lt;/code&gt; is passed, then none of the following should be provided.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;resource_name&lt;/code&gt;: The name of the resource which will be created.
This string will be prepended with the workflow name.
This may contain &lt;code&gt;PipelineParam&lt;/code&gt;s.
(&lt;em&gt;required&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;size&lt;/code&gt;: The requested size for the PVC.
This may contain &lt;code&gt;PipelineParam&lt;/code&gt;s.
(&lt;em&gt;required&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;storage_class&lt;/code&gt;: The storage class to be used.
This may contain &lt;code&gt;PipelineParam&lt;/code&gt;s.
(&lt;em&gt;optional&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;modes&lt;/code&gt;: The &lt;code&gt;accessModes&lt;/code&gt; of the PVC (defaults to &lt;code&gt;RWM&lt;/code&gt;).
Check
&lt;a href=&#34;https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes&#34;&gt;this documentation&lt;/a&gt;
for further information.
The user may find the following modes built-in:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;VOLUME_MODE_RWO&lt;/code&gt;: &lt;code&gt;[&amp;quot;ReadWriteOnce&amp;quot;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;VOLUME_MODE_RWM&lt;/code&gt;: &lt;code&gt;[&amp;quot;ReadWriteMany&amp;quot;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;VOLUME_MODE_ROM&lt;/code&gt;: &lt;code&gt;[&amp;quot;ReadOnlyMany&amp;quot;]&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;annotations&lt;/code&gt;: Annotations to be patched in the PVC.
These may contain &lt;code&gt;PipelineParam&lt;/code&gt;s.
(&lt;em&gt;optional&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;data_source&lt;/code&gt;: It is used to create a PVC from a &lt;code&gt;VolumeSnapshot&lt;/code&gt;.
It can be either a &lt;code&gt;string&lt;/code&gt; or a &lt;code&gt;V1TypedLocalObjectReference&lt;/code&gt;, and may contain
&lt;code&gt;PipelineParam&lt;/code&gt;s. (&lt;em&gt;Alpha feature&lt;/em&gt;, &lt;em&gt;optional&lt;/em&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;outputs-1&#34;&gt;Outputs&lt;/h4&gt;
&lt;p&gt;Additionally to the whole specification of the resource and its name
(&lt;code&gt;ResourceOp&lt;/code&gt; defaults), a &lt;code&gt;VolumeOp&lt;/code&gt; also outputs the storage size of the
bounded Persistent Volume (as &lt;code&gt;step.outputs[&amp;quot;size&amp;quot;]&lt;/code&gt;).
However, this may be empty if the storage provisioner has a
&lt;code&gt;WaitForFirstConsumer&lt;/code&gt; binding mode.
This value, if not empty, is always greater than or equal to the requested size.&lt;/p&gt;
&lt;h4 id=&#34;useful-information&#34;&gt;Useful information&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;VolumeOp&lt;/code&gt; steps have a &lt;code&gt;.volume&lt;/code&gt; attribute which is a &lt;code&gt;PipelineVolume&lt;/code&gt;
referencing the created PVC.
More information on Pipeline Volumes in the following section.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;ContainerOp&lt;/code&gt; has a &lt;code&gt;pvolumes&lt;/code&gt; argument in its constructor.
This is a dictionary with mount paths as keys and volumes as values and
functions similarly to &lt;code&gt;file_outputs&lt;/code&gt; (which can then be used as
&lt;code&gt;op.outputs[&amp;quot;key&amp;quot;]&lt;/code&gt; or &lt;code&gt;op.output&lt;/code&gt;).
For example:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;color:#000&#34;&gt;vop&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;VolumeOp&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;volume_creation&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;resource_name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;mypvc&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;size&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;1Gi&amp;#34;&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;step1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;ContainerOp&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;step1&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;...&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;pvolumes&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;/mnt&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;vop&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;volume&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Implies execution after vop&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;step2&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;ContainerOp&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;step2&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;...&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;pvolumes&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;/data&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;step1&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;pvolume&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Implies execution after step1&lt;/span&gt;
              &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;/mnt&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;PipelineVolume&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;pvc&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;existing-pvc&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)}&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color:#000&#34;&gt;step3&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;dsl&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;ContainerOp&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;step3&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;...&lt;/span&gt;
    &lt;span style=&#34;color:#000&#34;&gt;pvolumes&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;/common&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;step2&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;pvolumes&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;/mnt&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]}&lt;/span&gt;  &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Implies execution after step2&lt;/span&gt;
&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;pipelinevolume&#34;&gt;PipelineVolume&lt;/h3&gt;
&lt;p&gt;Reference Kubernetes volumes easily, mount them and express dependencies
through them.&lt;/p&gt;
&lt;p&gt;A &lt;code&gt;PipelineVolume&lt;/code&gt; is essentially a Kubernetes &lt;code&gt;Volume&lt;/code&gt;(*) carrying
dependencies, supplemented with an &lt;code&gt;.after()&lt;/code&gt; method extending them.
Those dependencies can then be parsed properly by a &lt;code&gt;ContainerOp&lt;/code&gt;, when consumed
in &lt;code&gt;pvolumes&lt;/code&gt; argument or &lt;code&gt;add_pvolumes()&lt;/code&gt; method, to extend the dependencies
of that step.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.PipelineVolume&#34;&gt;Link&lt;/a&gt;
to the corresponding Python library.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;(*) Inherits from V1Volume class of Kubernetes Python client.&lt;/em&gt;&lt;/p&gt;
&lt;h4 id=&#34;arguments-2&#34;&gt;Arguments&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;PipelineVolume&lt;/code&gt; constructor accepts all arguments &lt;code&gt;V1Volume&lt;/code&gt; constructor does.
However, &lt;code&gt;name&lt;/code&gt; can be omitted and a pseudo-random name for that volume is
generated instead.&lt;/p&gt;
&lt;p&gt;Extra arguments:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pvc&lt;/code&gt;: Name of an existing PVC to be referenced by this &lt;code&gt;PipelineVolume&lt;/code&gt;.
This value can be a &lt;code&gt;PipelineParam&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;volume&lt;/code&gt;: Initialize a new &lt;code&gt;PipelineVolume&lt;/code&gt; instance from an existing
&lt;code&gt;V1Volume&lt;/code&gt;, or its inherited types (e.g. &lt;code&gt;PipelineVolume&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;samples-1&#34;&gt;Samples&lt;/h3&gt;
&lt;p&gt;For better understanding, please refer to the following samples:
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/volume_ops/volume_ops.py&#34;&gt;1&lt;/a&gt;,
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/contrib/volume_ops/volumeop_dag.py&#34;&gt;2&lt;/a&gt;,
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/contrib/volume_ops/volumeop_parallel.py&#34;&gt;3&lt;/a&gt;,
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/contrib/volume_ops/volumeop_sequential.py&#34;&gt;4&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;volume-snapshots&#34;&gt;Volume Snapshots&lt;/h2&gt;
&lt;p&gt;Request the creation of Volume Snapshot instances simple and fast.&lt;/p&gt;
&lt;h3 id=&#34;volumesnapshotop&#34;&gt;VolumeSnapshotOp&lt;/h3&gt;
&lt;p&gt;A ResourceOp specialized in Volume Snapshot creation.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://kubeflow-pipelines.readthedocs.io/en/latest/source/kfp.dsl.html#kfp.dsl.VolumeSnapshotOp&#34;&gt;Link&lt;/a&gt;
to the corresponding Python library.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; You should check if your Kubernetes cluster admin has Volume Snapshots
enabled in your cluster.&lt;/p&gt;
&lt;h4 id=&#34;arguments-3&#34;&gt;Arguments&lt;/h4&gt;
&lt;p&gt;The following arguments are an extension to the &lt;code&gt;ResourceOp&lt;/code&gt; arguments.
If a &lt;code&gt;k8s_resource&lt;/code&gt; is passed, then none of the following may be provided.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;resource_name&lt;/code&gt;: The name of the resource which will be created.
This string will be prepended with the workflow name.
This may contain &lt;code&gt;PipelineParam&lt;/code&gt;s.
(&lt;em&gt;required&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pvc&lt;/code&gt;: The name of the PVC to be snapshotted.
This may contain &lt;code&gt;PipelineParam&lt;/code&gt;s.
(&lt;em&gt;optional&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;snapshot_class&lt;/code&gt;: The snapshot storage class to be used.
This may contain &lt;code&gt;PipelineParam&lt;/code&gt;s.
(&lt;em&gt;optional&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;volume&lt;/code&gt;: An instance of a &lt;code&gt;V1Volume&lt;/code&gt;, or its inherited type (e.g.
&lt;code&gt;PipelineVolume&lt;/code&gt;).
This may contain &lt;code&gt;PipelineParam&lt;/code&gt;s.
(&lt;em&gt;optional&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;annotations&lt;/code&gt;: Annotations to be patched in the &lt;code&gt;VolumeSnapshot&lt;/code&gt;.
These may contain &lt;code&gt;PipelineParam&lt;/code&gt;s.
(&lt;em&gt;optional&lt;/em&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; One of the &lt;code&gt;pvc&lt;/code&gt; or &lt;code&gt;volume&lt;/code&gt; needs to be provided.&lt;/p&gt;
&lt;h4 id=&#34;outputs-2&#34;&gt;Outputs&lt;/h4&gt;
&lt;p&gt;Additionally to the whole specification of the resource and its name
(&lt;code&gt;ResourceOp&lt;/code&gt; defaults), a &lt;code&gt;VolumeSnapshotOp&lt;/code&gt; also outputs the &lt;code&gt;restoreSize&lt;/code&gt; of
the bounded &lt;code&gt;VolumeSnapshot&lt;/code&gt; (as &lt;code&gt;step.outputs[&amp;quot;size&amp;quot;]&lt;/code&gt;).
This is the minimum size for a PVC clone of that snapshot.&lt;/p&gt;
&lt;h4 id=&#34;useful-information-1&#34;&gt;Useful information&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;VolumeSnapshotOp&lt;/code&gt; steps have a &lt;code&gt;.snapshot&lt;/code&gt; attribute which is a
&lt;code&gt;V1TypedLocalObjectReference&lt;/code&gt;.
This can be passed as a &lt;code&gt;data_source&lt;/code&gt; to create a PVC out of that
&lt;code&gt;VolumeSnapshot&lt;/code&gt;.
The user may otherwise use the &lt;code&gt;step.outputs[&amp;quot;name&amp;quot;]&lt;/code&gt; as &lt;code&gt;data_source&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;samples-2&#34;&gt;Samples&lt;/h3&gt;
&lt;p&gt;For better understanding, please refer to the following samples:
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/core/volume_snapshot_ops/volume_snapshot_ops.py&#34;&gt;1&lt;/a&gt;,
&lt;a href=&#34;https://github.com/kubeflow/pipelines/blob/master/samples/contrib/volume_snapshot_ops/volume_snapshotop_rokurl.py&#34;&gt;2&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;See samples in Kubeflow Pipelines
&lt;a href=&#34;https://github.com/kubeflow/pipelines/tree/master/samples&#34;&gt;repository&lt;/a&gt;.
For instance, check these samples of
&lt;a href=&#34;https://github.com/kubeflow/pipelines/tree/master/samples/core/resource_ops&#34;&gt;ResourceOps&lt;/a&gt;,
&lt;a href=&#34;https://github.com/kubeflow/pipelines/tree/master/samples/core/volume_ops&#34;&gt;VolumeOps&lt;/a&gt;
and
&lt;a href=&#34;https://github.com/kubeflow/pipelines/tree/master/samples/core/volume_snapshot_ops&#34;&gt;VolumeSnapshotOps&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Learn more about the
&lt;a href=&#34;/docs/pipelines/sdk/dsl-overview/&#34;&gt;Kubeflow Pipelines domain-specific language (DSL)&lt;/a&gt;,
a set of Python libraries that you can use to specify ML pipelines.&lt;/li&gt;
&lt;li&gt;For quick iteration,
&lt;a href=&#34;/docs/pipelines/sdk/build-component/&#34;&gt;build components and pipelines&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/pipelines/sdk/owners/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/pipelines/sdk/owners/</guid>
      <description>
        
        
        &lt;p&gt;approvers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;neuromage&lt;/li&gt;
&lt;li&gt;Ark-kun&lt;/li&gt;
&lt;li&gt;numerology
reviewers:&lt;/li&gt;
&lt;li&gt;8bitmp3&lt;/li&gt;
&lt;li&gt;RFMVasconcelos&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
  </channel>
</rss>
