From 8a20c605a7e51785ccd2dc8d39c06dba77f6084b Mon Sep 17 00:00:00 2001 From: Shashank Mittal Date: Mon, 8 Jul 2024 20:22:25 +0530 Subject: [PATCH] Distribution Type added Signed-off-by: Shashank Mittal modified feasibleSpace Removed Categorical from Distribution --- .../experiments/v1beta1/experiment_types.go | 18 +++++++++--- pkg/apis/v1beta1/openapi_generated.go | 6 ++++ pkg/apis/v1beta1/swagger.json | 3 ++ .../experiments/v1beta1/feasiblespace.go | 21 +++++++++++--- .../v1beta1/docs/V1beta1FeasibleSpace.md | 1 + .../katib/models/v1beta1_feasible_space.py | 28 ++++++++++++++++++- 6 files changed, 68 insertions(+), 9 deletions(-) diff --git a/pkg/apis/controller/experiments/v1beta1/experiment_types.go b/pkg/apis/controller/experiments/v1beta1/experiment_types.go index 37498f24442..19c5a83f051 100644 --- a/pkg/apis/controller/experiments/v1beta1/experiment_types.go +++ b/pkg/apis/controller/experiments/v1beta1/experiment_types.go @@ -207,12 +207,22 @@ const ( ) type FeasibleSpace struct { - Max string `json:"max,omitempty"` - Min string `json:"min,omitempty"` - List []string `json:"list,omitempty"` - Step string `json:"step,omitempty"` + Max string `json:"max,omitempty"` + Min string `json:"min,omitempty"` + List []string `json:"list,omitempty"` + Step string `json:"step,omitempty"` + Distribution Distribution `json:"distribution,omitempty"` } +type Distribution string + +const ( + DistributionUniform Distribution = "uniform" + DistributionLogUniform Distribution = "logUniform" + DistributionNormal Distribution = "normal" + DistributionLogNormal Distribution = "logNormal" +) + // TrialTemplate describes structure of trial template type TrialTemplate struct { // Retain indicates that trial resources must be not cleanup diff --git a/pkg/apis/v1beta1/openapi_generated.go b/pkg/apis/v1beta1/openapi_generated.go index de764c3d5ce..503dbc64b33 100644 --- a/pkg/apis/v1beta1/openapi_generated.go +++ b/pkg/apis/v1beta1/openapi_generated.go @@ -1090,6 +1090,12 @@ func schema_apis_controller_experiments_v1beta1_FeasibleSpace(ref common.Referen Format: "", }, }, + "distribution": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, }, }, }, diff --git a/pkg/apis/v1beta1/swagger.json b/pkg/apis/v1beta1/swagger.json index 2c2ab54f76e..6bf22ab0433 100644 --- a/pkg/apis/v1beta1/swagger.json +++ b/pkg/apis/v1beta1/swagger.json @@ -781,6 +781,9 @@ "v1beta1.FeasibleSpace": { "type": "object", "properties": { + "distribution": { + "type": "string" + }, "list": { "type": "array", "items": { diff --git a/pkg/client/controller/applyconfiguration/experiments/v1beta1/feasiblespace.go b/pkg/client/controller/applyconfiguration/experiments/v1beta1/feasiblespace.go index 0026c91b45b..5c01e8aaf1e 100644 --- a/pkg/client/controller/applyconfiguration/experiments/v1beta1/feasiblespace.go +++ b/pkg/client/controller/applyconfiguration/experiments/v1beta1/feasiblespace.go @@ -18,13 +18,18 @@ limitations under the License. package v1beta1 +import ( + v1beta1 "github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1" +) + // FeasibleSpaceApplyConfiguration represents an declarative configuration of the FeasibleSpace type for use // with apply. type FeasibleSpaceApplyConfiguration struct { - Max *string `json:"max,omitempty"` - Min *string `json:"min,omitempty"` - List []string `json:"list,omitempty"` - Step *string `json:"step,omitempty"` + Max *string `json:"max,omitempty"` + Min *string `json:"min,omitempty"` + List []string `json:"list,omitempty"` + Step *string `json:"step,omitempty"` + Distribution *v1beta1.Distribution `json:"distribution,omitempty"` } // FeasibleSpaceApplyConfiguration constructs an declarative configuration of the FeasibleSpace type for use with @@ -66,3 +71,11 @@ func (b *FeasibleSpaceApplyConfiguration) WithStep(value string) *FeasibleSpaceA b.Step = &value return b } + +// WithDistribution sets the Distribution field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Distribution field is set to the value of the last call. +func (b *FeasibleSpaceApplyConfiguration) WithDistribution(value v1beta1.Distribution) *FeasibleSpaceApplyConfiguration { + b.Distribution = &value + return b +} diff --git a/sdk/python/v1beta1/docs/V1beta1FeasibleSpace.md b/sdk/python/v1beta1/docs/V1beta1FeasibleSpace.md index e30d6292d7f..2a313ee5dd3 100644 --- a/sdk/python/v1beta1/docs/V1beta1FeasibleSpace.md +++ b/sdk/python/v1beta1/docs/V1beta1FeasibleSpace.md @@ -3,6 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**distribution** | **str** | | [optional] **list** | **list[str]** | | [optional] **max** | **str** | | [optional] **min** | **str** | | [optional] diff --git a/sdk/python/v1beta1/kubeflow/katib/models/v1beta1_feasible_space.py b/sdk/python/v1beta1/kubeflow/katib/models/v1beta1_feasible_space.py index 248318e80ed..439e9f65ff5 100644 --- a/sdk/python/v1beta1/kubeflow/katib/models/v1beta1_feasible_space.py +++ b/sdk/python/v1beta1/kubeflow/katib/models/v1beta1_feasible_space.py @@ -33,6 +33,7 @@ class V1beta1FeasibleSpace(object): and the value is json key in definition. """ openapi_types = { + 'distribution': 'str', 'list': 'list[str]', 'max': 'str', 'min': 'str', @@ -40,24 +41,28 @@ class V1beta1FeasibleSpace(object): } attribute_map = { + 'distribution': 'distribution', 'list': 'list', 'max': 'max', 'min': 'min', 'step': 'step' } - def __init__(self, list=None, max=None, min=None, step=None, local_vars_configuration=None): # noqa: E501 + def __init__(self, distribution=None, list=None, max=None, min=None, step=None, local_vars_configuration=None): # noqa: E501 """V1beta1FeasibleSpace - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration + self._distribution = None self._list = None self._max = None self._min = None self._step = None self.discriminator = None + if distribution is not None: + self.distribution = distribution if list is not None: self.list = list if max is not None: @@ -67,6 +72,27 @@ def __init__(self, list=None, max=None, min=None, step=None, local_vars_configur if step is not None: self.step = step + @property + def distribution(self): + """Gets the distribution of this V1beta1FeasibleSpace. # noqa: E501 + + + :return: The distribution of this V1beta1FeasibleSpace. # noqa: E501 + :rtype: str + """ + return self._distribution + + @distribution.setter + def distribution(self, distribution): + """Sets the distribution of this V1beta1FeasibleSpace. + + + :param distribution: The distribution of this V1beta1FeasibleSpace. # noqa: E501 + :type: str + """ + + self._distribution = distribution + @property def list(self): """Gets the list of this V1beta1FeasibleSpace. # noqa: E501