Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
avoid launching both chief and worker jobs when running a non distrib…
Browse files Browse the repository at this point in the history
…uted job (#50)
  • Loading branch information
hamedhsn authored and k8s-ci-robot committed Jan 9, 2019
1 parent 6c1f5bb commit 57a59d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion fairing/training/kubeflow/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, worker_count=0, ps_count=0, namespace=None):
super(DistributedTraining, self).__init__(namespace)
self.distribution = {
'Worker': worker_count,
'PS': ps_count
'PS': ps_count,
'Chief': 1
}

7 changes: 4 additions & 3 deletions fairing/training/kubeflow/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ def generate_job(self, pod_template_spec):
worker_replica_spec['template'] = pod_template_spec

ps_replica_spec = {}
ps_replica_spec['replicas'] = self.distribution['PS']
ps_replica_spec['replicas'] = self.distribution.get('PS', 0)
ps_replica_spec['template'] = pod_template_spec

chief_replica_spec = {}
chief_replica_spec['replicas'] = 1
chief_replica_spec['replicas'] = self.distribution.get('Chief', 0)
chief_replica_spec['template'] = pod_template_spec

spec = {}
spec['tfReplicaSpecs'] = {}
spec['tfReplicaSpecs']['Chief'] = chief_replica_spec
spec['tfReplicaSpecs']['Worker'] = worker_replica_spec
if chief_replica_spec['replicas'] > 0:
spec['tfReplicaSpecs']['Chief'] = chief_replica_spec
if ps_replica_spec['replicas'] > 0:
spec['tfReplicaSpecs']['PS'] = ps_replica_spec

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'notebook==5.6.0',
'jupyter==1.0.0',
'numpy==1.15.0',
'kubernetes==6.0.0',
'kubernetes==8.0.1',
'future==0.17.1',
'six==1.11.0',
'httplib2==0.12.0',
Expand Down

0 comments on commit 57a59d6

Please sign in to comment.