Skip to content

Commit

Permalink
added dco
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 5, 2024
1 parent fc858d1 commit e7eefc5
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions sdk/python/v1beta1/kubeflow/katib/api/katib_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,34 @@ def create_experiment(

namespace = namespace or self.namespace

experiment_name = experiment.metadata.name
if not experiment_name:
experiment_name = experiment.metadata.generate_name

try:
self.custom_api.create_namespaced_custom_object(
outputs = self.custom_api.create_namespaced_custom_object(
constants.KUBEFLOW_GROUP,
constants.KATIB_VERSION,
namespace,
constants.EXPERIMENT_PLURAL,
experiment,
)
experiment_name = outputs.metadata.name # if "generate_name" is used, "name" gets a prefix from server
except multiprocessing.TimeoutError:
raise TimeoutError(
f"Timeout to create Katib Experiment: {namespace}/{experiment.metadata.name}"
f"Timeout to create Katib Experiment: {namespace}/{experiment_name}"
)
except Exception as e:
if hasattr(e, "status") and e.status == 409:
raise Exception(
f"A Katib Experiment with the name {namespace}/{experiment.metadata.name} already exists."
f"A Katib Experiment with the name {namespace}/{experiment_name} already exists."
)
raise RuntimeError(
f"Failed to create Katib Experiment: {namespace}/{experiment.metadata.name}"
f"Failed to create Katib Experiment: {namespace}/{experiment_name}"
)

# TODO (andreyvelich): Use proper logger.
print(f"Experiment {namespace}/{experiment.metadata.name} has been created")
print(f"Experiment {namespace}/{experiment_name} has been created")

if self._is_ipython():
if self.in_cluster:
Expand All @@ -125,9 +130,9 @@ def create_experiment(
IPython.display.HTML(
"Katib Experiment {} "
'link <a href="/_/katib/#/katib/hp_monitor/{}/{}" target="_blank">here</a>'.format(
experiment.metadata.name,
experiment_name,
namespace,
experiment.metadata.name,
experiment_name,
)
)
)
Expand Down

0 comments on commit e7eefc5

Please sign in to comment.