Type ClusterSpec
Namespace tensorflow.train
Parent PythonObjectContainer
Interfaces IClusterSpec
Represents a cluster as a set of "tasks", organized into "jobs". A
tf.train.ClusterSpec
represents the set of processes that
participate in a distributed TensorFlow computation. Every
tf.distribute.Server
is constructed in a particular cluster. To create a cluster with two jobs and five tasks, you specify the
mapping from job names to lists of network addresses (typically
hostname-port pairs).
Each job may also be specified as a sparse mapping from task indices
to network addresses. This enables a server to be configured without
needing to know the identity of (for example) all other worker
tasks:
Show Example
cluster = tf.train.ClusterSpec({"worker": ["worker0.example.com:2222", "worker1.example.com:2222", "worker2.example.com:2222"], "ps": ["ps0.example.com:2222", "ps1.example.com:2222"]})
Methods
- as_cluster_def
- as_cluster_def_dyn
- job_tasks
- job_tasks_dyn
- num_tasks
- num_tasks_dyn
- task_address
- task_address_dyn
- task_indices
- task_indices_dyn
Properties
Public instance methods
object as_cluster_def()
Returns a
tf.train.ClusterDef
protocol buffer based on this cluster.
object as_cluster_def_dyn()
Returns a
tf.train.ClusterDef
protocol buffer based on this cluster.
IList<object> job_tasks(string job_name)
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.train.ClusterSpec.num_tasks
method
to find the number of tasks defined in a particular job.
Parameters
-
string
job_name - The string name of a job in this cluster.
Returns
-
IList<object>
- A list of task addresses, where the index in the list corresponds to the task index of each task. The list may contain `None` if the job was defined with a sparse set of task indices.
object job_tasks_dyn(object job_name)
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.train.ClusterSpec.num_tasks
method
to find the number of tasks defined in a particular job.
Parameters
-
object
job_name - The string name of a job in this cluster.
Returns
-
object
- A list of task addresses, where the index in the list corresponds to the task index of each task. The list may contain `None` if the job was defined with a sparse set of task indices.
int num_tasks(string job_name)
Returns the number of tasks defined in the given job.
Parameters
-
string
job_name - The string name of a job in this cluster.
Returns
-
int
- The number of tasks defined in the given job.
object num_tasks_dyn(object job_name)
Returns the number of tasks defined in the given job.
Parameters
-
object
job_name - The string name of a job in this cluster.
Returns
-
object
- The number of tasks defined in the given job.
object task_address(string job_name, Nullable<int> task_index)
Returns the address of the given task in the given job.
Parameters
-
string
job_name - The string name of a job in this cluster.
-
Nullable<int>
task_index - A non-negative integer.
Returns
-
object
- The address of the given task in the given job.
object task_address_dyn(object job_name, object task_index)
Returns the address of the given task in the given job.
Parameters
-
object
job_name - The string name of a job in this cluster.
-
object
task_index - A non-negative integer.
Returns
-
object
- The address of the given task in the given job.
IList<object> task_indices(string job_name)
Returns a list of valid task indices in the given job.
Parameters
-
string
job_name - The string name of a job in this cluster.
Returns
-
IList<object>
- A list of valid task indices in the given job.
object task_indices_dyn(object job_name)
Returns a list of valid task indices in the given job.
Parameters
-
object
job_name - The string name of a job in this cluster.
Returns
-
object
- A list of valid task indices in the given job.
Public properties
IList<object> jobs get;
Returns a list of job names in this cluster.
object jobs_dyn get;
Returns a list of job names in this cluster.