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

Method job_tasks

tensorflow/python/training/server_lib.py:437–464  ·  view source on GitHub ↗

Returns a mapping from task ID to address in the given job. NOTE: For backwards compatibility, this method returns a list. If the given job was defined with a sparse set of task indices, the length of this list may not reflect the number of tasks defined in this job. Use the `tf.tra

(self, job_name)

Source from the content-addressed store, hash-verified

435 (task_index, job_name))
436
437 def job_tasks(self, job_name):
438 """Returns a mapping from task ID to address in the given job.
439
440 NOTE: For backwards compatibility, this method returns a list. If
441 the given job was defined with a sparse set of task indices, the
442 length of this list may not reflect the number of tasks defined in
443 this job. Use the `tf.train.ClusterSpec.num_tasks` method
444 to find the number of tasks defined in a particular job.
445
446 Args:
447 job_name: The string name of a job in this cluster.
448
449 Returns:
450 A list of task addresses, where the index in the list
451 corresponds to the task index of each task. The list may contain
452 `None` if the job was defined with a sparse set of task indices.
453
454 Raises:
455 ValueError: If `job_name` does not name a job in this cluster.
456 """
457 try:
458 job = self._cluster_spec[job_name]
459 except KeyError:
460 raise ValueError("No such job in cluster: %r" % job_name)
461 ret = [None for _ in range(max(job.keys()) + 1)]
462 for i, task in job.items():
463 ret[i] = task
464 return ret
465
466 def _make_cluster_def(self):
467 """Creates a `tf.train.ClusterDef` based on the given `cluster_spec`.

Callers 9

as_dictMethod · 0.95
_is_distributedFunction · 0.80
_get_masterFunction · 0.80
_get_global_idFunction · 0.80
_updateMethod · 0.80
_get_master_targetMethod · 0.80
masterMethod · 0.80
masterMethod · 0.80

Calls 3

rangeFunction · 0.50
maxFunction · 0.50
keysMethod · 0.45

Tested by 1