MCPcopy Index your code
hub / github.com/tensorlayer/TensorLayer / TaskSpecDef

Class TaskSpecDef

tensorlayer/distributed.py:231–363  ·  view source on GitHub ↗

Specification for a distributed task. It contains the job name, index of the task, the parameter servers and the worker servers. If you want to use the last worker for continuous evaluation you can call the method `use_last_worker_as_evaluator` which returns a new :class:`TaskSpecDe

Source from the content-addressed store, hash-verified

229
230@deprecated(date="2018-10-30", instructions="Using the TensorLayer distributed trainer.")
231class TaskSpecDef(object):
232 """Specification for a distributed task.
233
234 It contains the job name, index of the task,
235 the parameter servers and the worker servers. If you want to use the last worker
236 for continuous evaluation you can call the method `use_last_worker_as_evaluator`
237 which returns a new :class:`TaskSpecDef` object without the last worker in the
238 cluster specification.
239
240 Parameters
241 ----------
242 task_type : str
243 Task type. One of `master`, `worker` or `ps`.
244 index : int
245 The zero-based index of the task. Distributed training jobs will have a single
246 master task, one or more parameter servers, and one or more workers.
247 trial : int
248 The identifier of the trial being run.
249 ps_hosts : str OR list of str
250 A string with a coma separate list of hosts for the parameter servers
251 or a list of hosts.
252 worker_hosts : str OR list of str
253 A string with a coma separate list of hosts for the worker servers
254 or a list of hosts.
255 master : str
256 A string with the master hosts
257
258 Notes
259 ----------
260 master might not be included in TF_CONFIG and can be None. The shard_index is adjusted
261 in any case to assign 0 to master and >= 1 to workers.
262 This implementation doesn't support sparse arrays in the `TF_CONFIG` variable as the
263 official TensorFlow documentation shows, as it is not a supported by the json
264 definition.
265
266 References
267 ----------
268 - `ML-engine trainer considerations <https://cloud.google.com/ml-engine/docs/trainer-considerations#use_tf_config>`__
269
270 """
271
272 def __init__(self, task_type='master', index=0, trial=None, ps_hosts=None, worker_hosts=None, master=None):
273 self.type = task_type
274 self._index = int(index)
275 self._cluster_spec = None
276 self.num_workers = 1
277 self.num_ps = 0
278 self.shard_index = int(index)
279 self._master = True
280 self.trial = trial
281 self.ps_hosts = ps_hosts
282 self.worker_hosts = worker_hosts
283 self.master = master
284 self._server = None
285
286 if ps_hosts and worker_hosts:
287 self.ps_hosts = ps_hosts if isinstance(ps_hosts, list) else ps_hosts.split(',')
288 self.num_ps = len(self.ps_hosts)

Callers 2

create_task_spec_defFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…