(ps_hosts, worker_hosts, worker_id)
| 153 | server.join() |
| 154 | |
| 155 | def worker_fn(ps_hosts, worker_hosts, worker_id): |
| 156 | cluster = server_lib.ClusterSpec( |
| 157 | {"ps": ps_hosts, "worker": worker_hosts}) |
| 158 | worker = server_lib.Server( |
| 159 | cluster, job_name="worker", task_index=worker_id, start=True, |
| 160 | config=self._config) |
| 161 | with ops.Graph().as_default(): |
| 162 | with ops.device(device_setter.replica_device_setter(cluster=cluster)): |
| 163 | with ops.device('/cpu:0'): |
| 164 | training_util.get_or_create_global_step() |
| 165 | work_queue = WorkQueue( |
| 166 | [b"fast", b"fox", b"jumps", b"over", b"lazy", b"dog"], |
| 167 | num_epochs=3, shuffle=False, name='global_queue') |
| 168 | local_queue = work_queue.input_producer() |
| 169 | read_op = local_queue.dequeue() |
| 170 | with monitored_session.MonitoredTrainingSession( |
| 171 | master=worker.target) as sess: |
| 172 | sess.run(read_op) |
| 173 | ps_proc = Process(target=ps_fn, args=(ps_hosts, worker_hosts)) |
| 174 | ps_proc.start() |
| 175 | worker_proc = Process( |
nothing calls this directly
no test coverage detected