Skip to content

Commit

Permalink
added exception to catch missing name and generateName
Browse files Browse the repository at this point in the history
Signed-off-by: Bharath Krishna <bharathk005@gmail.com>
  • Loading branch information
bharathk005 committed Mar 7, 2024
1 parent 1039f4b commit 5be7150
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sdk/python/v1beta1/kubeflow/katib/api/katib_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5be7150

Please sign in to comment.