From 5be7150ac760c800bdab156a01dff290ec67d3bd Mon Sep 17 00:00:00 2001 From: Bharath Krishna Date: Wed, 6 Mar 2024 18:46:12 -0800 Subject: [PATCH] added exception to catch missing name and generateName Signed-off-by: Bharath Krishna --- sdk/python/v1beta1/kubeflow/katib/api/katib_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py b/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py index 7978322b27d..d0c4a137e98 100644 --- a/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py +++ b/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py @@ -93,11 +93,15 @@ def create_experiment( namespace = namespace or self.namespace - if 'name' in experiment.metadata and experiment.metadata.name: + experiment_name = None + if experiment.metadata.name is not None: experiment_name = experiment.metadata.name - else: + elif experiment.metadata.generate_name is not None: experiment_name = experiment.metadata.generate_name + if experiment_name is None: + raise ValueError("Experiment must have a name or generateName") + try: outputs = self.custom_api.create_namespaced_custom_object( constants.KUBEFLOW_GROUP,