Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Does tfJob support setting different label/envVar for each worker(replicas >1)? #340

Closed
sdf611097 opened this issue Jan 23, 2018 · 7 comments

Comments

@sdf611097
Copy link
Contributor

sdf611097 commented Jan 23, 2018

In my case, I have some tools which are designed by pod label. How can I set different label for each pod which is created by tfJob? (N workers with different custom labels)

    - replicas: 2
      tfReplicaType: WORKER
      template:
        spec:
          containers:
            - image: gcr.io/tf-on-k8s-dogfood/tf_sample:dc944ff
              name: tensorflow
          restartPolicy: OnFailure
          #replicaLabels: 
          #- labelA: valueA-0
          #  labelB: valueB-0
          #- labelA: valueA-1
          #  labelB: valueB-1

If not, are there any hints or suggestions to do this(Maybe I can make a PR). Such as naming, how to validating(spec.replicaSpecs.replicas equal to replicaLabels size) and so on.

@gaocegege
Copy link
Member

gaocegege commented Jan 24, 2018

@sdf611097

You could add labels in the YAML file and I think it should be added into the jobs and services created by the TFJob. If not I think it is a bug.

@sdf611097 sdf611097 changed the title [feature] Does tfJob support setting different label/envVar for each worker/ps? [feature] Does tfJob support setting different label/envVar for each worker(replicas >1)? Jan 25, 2018
@sdf611097
Copy link
Contributor Author

@gaocegege

I can set same labels to N workers as expected, but I don't know how to set different label for each worker. For example, I have 2 worker, each worker need 2 label (labelA, labelB).

worker0:
   labelA: valueA-0
   labelB: valueB-0
worker1:
   labelA: valueA-1
   labelB: valueB-1

P.S. I think my question is not clearly, so I made some modifications.

@gaocegege
Copy link
Member

@sdf611097

Got it, then it is a new feature.

@jlewi
Copy link
Contributor

jlewi commented Jan 25, 2018

You can't add individual labels specific to a replica (e.g. worker 0 vs. worker1). We do however add standard labels corresponding to the replica type and replica index.

@jlewi
Copy link
Contributor

jlewi commented Feb 4, 2018

@sdf611097 Does this address your needs?

@sdf611097
Copy link
Contributor Author

Yes. If I still need to set different label or env var for each job, I will send a PR.

@jlewi
Copy link
Contributor

jlewi commented Feb 5, 2018

@sdf611097 Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants