kubeflow / pipelines

Machine Learning Pipelines for Kubeflow
https://www.kubeflow.org/docs/components/pipelines/
Apache License 2.0
3.53k stars 1.59k forks source link

Pipeline Parameter Attributes (e.g. Grouping and Descriptions) #6364

Closed BenoitLeguay closed 4 months ago

BenoitLeguay commented 2 years ago

This feature request comes from this issue from @daenuprobst. @DavidSpek asked him to move it from kubeflow/kubeflow to kubeflow/pipelines but as the author did not do it and because I'm really interested in such a feature, I do it by my own. (I only copy paste the issue tell me if you need more info)

/kind feature

Why you need this feature: When creating a pipeline that exposes a relatively large (5-10+) number of run parameters, the generated list of parameter input fields in the frontend becomes confusing (when creating a new run). Especially when there are parameters with the same name / function for multiple steps in the pipeline, the only way to make them distinguishable is to give them increasingly complex variable names. This can easily lead to mistakes when users create new runs.

Describe the solution you'd like: For each pipeline parameter there should be a possibility so specify attributes such as a group and a description, which will then be reflected in the frontend. A dict in the dsl.pipeline decorator might be a good place to add this additional information.

zijianjoy commented 2 years ago

@BenoitLeguay You can create a json parameter which allows you to specify arbitrary key-value pair.

BenoitLeguay commented 2 years ago

I will try that ! Thank you @zijianjoy ! Are there any examples or documentation on this method ?

zijianjoy commented 2 years ago

@BenoitLeguay You just need to provide a stringify format of JSON to the parameter. For example:

import kfp
from kfp import dsl
from kfp.components import create_component_from_func

@create_component_from_func
def test(json_param: str):
    print(json_param)

@dsl.pipeline(name='bug-json-param')
def my_pipeline(
    json_param: str = '{"a":"b"}',
    value: str = 'c',
):
    test(json_param).set_display_name('test1')
    test('{"a":"' + f'{value}' + '"}').set_display_name('test2')

if __name__ == '__main__':
    kfp.Client().create_run_from_pipeline_func(
        my_pipeline,
        arguments={}
    )

Or if you compile any pipeline with parameter input, then upload them via KFP UI. You can paste {} to the Run parameters to open JSON editor:

jsonparameter

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

rimolive commented 4 months ago

Closing this issue. No activity since 2022.

/close

google-oss-prow[bot] commented 4 months ago

@rimolive: Closing this issue.

In response to [this](https://github.com/kubeflow/pipelines/issues/6364#issuecomment-1998507058): >Closing this issue. No activity since 2022. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.