Skip to content

Commit

Permalink
Use tf_job_name not tf_job_key as the label name. (kubeflow#689)
Browse files Browse the repository at this point in the history
* Use tf_job_name not tf_job_key as the label name.

* tf_job_name is consistent with v1alpha1; this desirable from a compatibility
  perspective.

* tf_job_key isn't quite right because the job key includes namespace
  but we are no longer using the namespace in the value

Related to kubeflow#672

* Run goimports.

* Fix E2E tests.

* Increase timeout because pods are stuck in pending state.
  • Loading branch information
jlewi authored and k8s-ci-robot committed Jun 21, 2018
1 parent f9b9551 commit 640f175
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pkg/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

const (
LabelGroupName = "group_name"
labelTFJobKey = "tf_job_key"
labelTFJobName = "tf_job_name"
)

var (
Expand All @@ -48,10 +48,10 @@ func GenOwnerReference(tfjob *tfv1alpha2.TFJob) *metav1.OwnerReference {
return controllerRef
}

func GenLabels(tfjobKey string) map[string]string {
func GenLabels(tfJobName string) map[string]string {
return map[string]string{
LabelGroupName: tfv1alpha2.GroupName,
labelTFJobKey: strings.Replace(tfjobKey, "/", "-", -1),
labelTFJobName: strings.Replace(tfJobName, "/", "-", -1),
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/generator/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func TestGenLabels(t *testing.T) {

labels := GenLabels(testKey)

if labels[labelTFJobKey] != expctedKey {
t.Errorf("Expected %s %s, got %s", labelTFJobKey, expctedKey, labels[labelTFJobKey])
if labels[labelTFJobName] != expctedKey {
t.Errorf("Expected %s %s, got %s", labelTFJobName, expctedKey, labels[labelTFJobName])
}
if labels[LabelGroupName] != tfv1alpha2.GroupName {
t.Errorf("Expected %s %s, got %s", LabelGroupName, tfv1alpha2.GroupName, labels[LabelGroupName])
Expand Down
4 changes: 2 additions & 2 deletions py/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_labels_v1alpha2(name, replica_type=None,
"""
labels = {
"group_name": "kubeflow.org",
"tf_job_key": name,
"tf_job_name": name,
}
if replica_type:
labels["tf-replica-type"] = replica_type
Expand Down Expand Up @@ -458,7 +458,7 @@ def run_test(args): # pylint: disable=too-many-branches,too-many-statements
pod_selector,
["Running"],
timeout=datetime.timedelta(
minutes=2))
minutes=4))
logging.info("Pods are ready")
logging.info("Issuing the terminate request")
terminateReplica(masterHost, namespace, target)
Expand Down

0 comments on commit 640f175

Please sign in to comment.