Pipeline Parameters

Passing data between pipeline components

The kfp.dsl.PipelineParamclassrepresents a data type that you can pass between pipeline components.

You can use a PipelineParam object as an argument in your pipeline function.The object is then a pipeline parameter that shows up in Kubeflow Pipelines UI.A PipelineParam can also represent an intermediate value that you pass betweencomponents.

The following code sample shows how to use PipelineParam objects asarguments in a pipeline function:

  1. @kfp.dsl.pipeline(
  2. name='My pipeline',
  3. description='My machine learning pipeline'
  4. )
  5. def my_pipeline(
  6. my_num = dsl.PipelineParam(name='num-foos', value=1000),
  7. my_name = dsl.PipelineParam(name='my-name', value='some text'),
  8. my_url = dsl.PipelineParam(name='foo-url', value='http://example.com')):
  9. ...

The DSL supports auto-conversion from string to PipelineParam. You cantherefore write the same function like this:

  1. @kfp.dsl.pipeline(
  2. name='My pipeline',
  3. description='My machine learning pipeline'
  4. )
  5. def my_pipeline(
  6. my_num='1000',
  7. my_name='some text',
  8. my_url='http://example.com'):
  9. ...

See more about PipelineParam objects in the guide to building acomponent.