kubeflow / pipelines

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

[feature] Add support for `StrEnum`|`Literal` type parameters #11385

Open tumido opened 4 days ago

tumido commented 4 days ago

Feature Area

/area frontend /area backend /area sdk

Not sure if the choice of feature area is 100% correct, please correct me if I'm wrong.

What feature would you like to see?

In many cases a pipeline author has a pretty strict idea about the options they want to allow users to choose from - a single (or even multi) choice params if you will. As of today KFP supports only a few arbitrary types, where str is the widest of all. It would be neat if could can narrow it down to a single choice selection dropdown in cases when the parameter value is explicitly requested to be constrained and the supported values are known ahead of time.

This will help in cases like:

Having such option helps in navigating users, reduces mistakes and amount of failed executions because of typos and allows the pipeline author to provide a clear list of supported option values, etc...

What is the use case or pain point?

Using a string type for a single choice parameter value is cumbersome since it requires the user to know which values are supported (this can be only done via documentation) and requires runtime checks for valid input.

Is there a workaround currently?

For a choice between 2 options a bool param can be used, for more than 2 options a str param. As noted above, this is not ideal...


Love this idea? Give it a 👍.

HumairAK commented 4 days ago

Love this, I think this would be a great addition