tf.train.ClusterSpec

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).

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"]})

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:

cluster = tf.train.ClusterSpec({"worker": {1: "worker1.example.com:2222"},
                                "ps": ["ps0.example.com:2222",
                                       "ps1.example.com:2222"]})

cluster A dictionary mapping one or more job names to (i) a list of network addresses, or (ii) a dictionary mapping integer task indices to network addresses; or a tf.train.ClusterDef protocol buffer.

TypeError If cluster is not a dictionary mapping strings to lists of strings, and not a tf.train.ClusterDef protobuf.

jobs Returns a list of job names in this cluster.

Methods

as_cluster_def

View source