Skip to content

Commit

Permalink
Katib Launcher Experiment Name Conflict (#3508)
Browse files Browse the repository at this point in the history
* added uuid to experiment name so that it does not conflict when trying katib experiment with same name

* added uuid to experiment name so that it does not conflict when trying katib experiment with same name

* experiment name limited to 64 characters

* updated user name and email for the repo

* fixed the typo

Co-authored-by: Sandhya <sandhya@imanage.com>
  • Loading branch information
gosandhya and Sandhya8imanage authored May 5, 2020
1 parent 657b5d4 commit a539d53
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/kubeflow/katib-launcher/src/launch_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import os
import logging
import yaml
import uuid
import launch_crd

from kubernetes import client as k8s_client
Expand Down Expand Up @@ -99,11 +100,13 @@ def main(argv=None):
config.load_incluster_config()
api_client = k8s_client.ApiClient()
experiment = Experiment(version=args.version, client=api_client)
exp_name = (args.name+'-'+uuid.uuid4().hex)[0:63]

inst = {
"apiVersion": "%s/%s" % (ExperimentGroup, args.version),
"kind": "Experiment",
"metadata": {
"name": args.name,
"name": exp_name,
"namespace": args.namespace,
},
"spec": {
Expand All @@ -121,7 +124,7 @@ def main(argv=None):

expected_conditions = ["Succeeded", "Failed"]
current_inst = experiment.wait_for_condition(
args.namespace, args.name, expected_conditions,
args.namespace, exp_name, expected_conditions,
timeout=datetime.timedelta(minutes=args.experimentTimeoutMinutes))
expected, conditon = experiment.is_expected_conditions(current_inst, ["Succeeded"])
if expected:
Expand All @@ -131,7 +134,7 @@ def main(argv=None):
with open(args.outputFile, 'w') as f:
f.write(json.dumps(paramAssignments))
if args.deleteAfterDone:
experiment.delete(args.name, args.namespace)
experiment.delete(exp_name, args.namespace)

if __name__== "__main__":
main()

0 comments on commit a539d53

Please sign in to comment.