class_docstr: Manages the status/heartbeat monitor for a set of workers.
class_docstr_tok: ["Manages","the","status\/heartbeat","monitor","for","a","set","of","workers","."]
docstr: Construct a heartbeat manager for the given devices.
docstr_tok: ["Construct","a","heartbeat","manager","for","the","given","devices","."]
code: def from_devices(session, devices):
      """Construct a heartbeat manager for the given devices."""
      if not devices:
          logging.error(
              "Trying to create heartbeat manager with no devices?"
          )
  
      logging.info("Creating heartbeat manager for %s", devices)
      request_placeholder = array_ops.placeholder(
          name="worker_heartbeat_request", dtype=dtypes.string
      )
  
      heartbeat_ops = []
      for device in devices:
          with ops.device(device):
              heartbeat_ops.append(
                  tpu_ops.worker_heartbeat(request_placeholder)
              )
  
      return WorkerHeartbeatManager(
          session, devices, heartbeat_ops, request_placeholder
      )
  
imports: import threading
  import time
  from google.protobuf import text_format
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.util import event_pb2
  from tensorflow.python.client import session
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.tpu.ops import tpu_ops
  from tensorflow.python.training import session_run_hook
  from tensorflow.python.training import training_util
label_desc: Use image node_id 2 for calling the WorkerHeartbeatManager obj's underlying member method code with example usage: obj.from_devices(session, devices) and returns: WorkerHeartbeatManager