Skip to content

katib.search.categorical incorrectly populates "distribution" instead of "list" in V1beta1FeasibleSpace causing webhook rejectionΒ #2625

@Doel10

Description

@Doel10

What happened?

The Python SDK helper function katib.search.categorical() incorrectly constructs V1beta1FeasibleSpace by passing the categorical values as positional argument.

def categorical(list: List):
    """Sample a categorical value from the `list`.

    Args:
        list: List of categorical values.
    """

    return models.V1beta1ParameterSpec(
        parameter_type="categorical",
        feasible_space=models.V1beta1FeasibleSpace(list),
    )

Passing list as positional argument to V1beta1FeasibleSpace, it is assigned to the distribution field instead of the list field. This results in a wrong generated JSON:

l = ["a", "b"]
katib.search.categorical(l)
{'feasible_space': {'distribution': ['a', 'b'],
                    'list': None,
                    'max': None,
                    'min': None,
                    'step': None},
 'name': None,
 'parameter_type': 'categorical'}

The admission webhook rejects the experiment.

What did you expect to happen?

katib.search.categorical() should construct V1beta1FeasibleSpace using positional argument list=list resulting in:

l = ["a", "b"]
katib.search.categorical(l)
{'feasible_space': {'distribution': None,
                    'list': ['a', 'b'],
                    'max': None,
                    'min': None,
                    'step': None},
 'name': None,
 'parameter_type': 'categorical'}

Environment

Kubernetes version:

$ kubectl version
Client Version: v1.35.0
Kustomize Version: v5.7.1
Server Version: v1.35.0

Katib controller version:

$ kubectl get pods -n kubeflow -l katib.kubeflow.org/component=controller -o jsonpath="{.items[*].spec.containers[*].image}"
ghcr.io/kubeflow/katib/katib-controller:v0.19.0

Katib Python SDK version:

$ pip show kubeflow-katib
Name: kubeflow-katib
Version: 0.19.0
Summary: Katib Python SDK for APIVersion v1beta1
Home-page: https://github.com/kubeflow/katib/tree/master/sdk/python/v1beta1
Author: Kubeflow Authors
Author-email: premnath.vel@gmail.com
License: Apache License Version 2.0
Location: C:\Users\dorazioel\Desktop\kubeflow\.venv\Lib\site-packages
Requires: certifi, grpcio, kubeflow-training, kubernetes, protobuf, setuptools, six, urllib3
Required-by:

Impacted by this bug?

Give it a πŸ‘ We prioritize the issues with most πŸ‘

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions