MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / worker_fn

Method worker_fn

tensorflow/python/ops/work_queue_test.py:155–172  ·  view source on GitHub ↗
(ps_hosts, worker_hosts, worker_id)

Source from the content-addressed store, hash-verified

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(

Callers

nothing calls this directly

Calls 8

input_producerMethod · 0.95
WorkQueueClass · 0.90
ServerMethod · 0.80
as_defaultMethod · 0.45
GraphMethod · 0.45
deviceMethod · 0.45
dequeueMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected