class_docstr: Cluster manager for TensorFlow servers.
code: def __init__(self, resource_spec: ResourceSpec):
      self.cluster_spec = self._get_default_cluster_spec(resource_spec)
      self._cpu_devices = self._get_node_cpu_devices(resource_spec)
      self._gpu_devices = self._get_node_gpu_devices(resource_spec)
      self._chief = resource_spec.chief
      self._full_addresses = [
          full_address
          for tasks in self.cluster_spec.values()
          for full_address in tasks
      ]
      # noinspection PyTypeChecker
      self._address_to_port = dict(
          a.split(":") for a in self._full_addresses
      )
      self._task_to_address = {
          (job_name, task_index): a.split(":")[0]
          for job_name, tasks in self.cluster_spec.items()
          for task_index, a in enumerate(tasks)
      }
      self.subprocesses = []
      logging.info("ClusterSpec: {}".format(self.cluster_spec))
  
imports: import atexit
  import contextlib
  import json
  import os
  import signal
  import subprocess
  import sys
  import warnings
  from abc import ABCMeta, abstractmethod
  import paramiko
  from autodist.const import DEFAULT_PORT_RANGE, DEFAULT_WORKING_DIR, ENV
  from autodist.resource_spec import ResourceSpec
  from autodist.utils import logging
label_desc: Use image node_id 1 to create a new Cluster object  with example: obj = Cluster(resource_spec)