class_docstr: Resource Spec.
  
  Contains node and SSH information found by parsing a `resource_spec.yml`.
  
  # TODO: Make it a real Graph (a clique), with edge weights being network bandwidth.
      This would allow for even more intelligent strategy generation.
class_docstr_tok: ["Resource","Spec",".","Contains","node","and","SSH","information","found","by","parsing","a","`","resource_spec.yml","`",".","#","TODO",":","Make","it","a","real","Graph","(","a","clique",")",",","with","edge","weights","being","network","bandwidth",".","This","would","allow","for","even","more","intelligent","strategy","generation","."]
docstr: Construct a device graph containing the connectivity between devices.
  
  Each device is represented as an autodist.device_spec.
  If resource_file is None, use the local machines and all visible GPUs.
  
  Args:
      resource_file (string, optional): path to the file containing the resource info. Defaults to None.
code: def __init__(self, resource_file=None):
      """
      Construct a device graph containing the connectivity between devices.
  
      Each device is represented as an autodist.device_spec.
      If resource_file is None, use the local machines and all visible GPUs.
  
      Args:
          resource_file (string, optional): path to the file containing the resource info. Defaults to None.
      """
      # protected properties
      self.__devices = dict()
      self.__nodes = None
      self.__cpu_devices = None
      self.__num_cpus = None
      self.__gpu_devices = None
      self.__num_gpus = None
      self.__chief_address = None
      self.__ssh_config_map = dict()
      self.__ssh_group = dict()
      self.__network_bandwidth = dict()
  
      # set self.__devices
      self._from_resource_info(resource_file)
  
imports: import os
  import re
  from enum import Enum
  from typing import NamedTuple, Optional, Dict
  import yaml
  import paramiko
  from autodist.utils import logging
  from autodist.utils.network import is_loopback_address, is_local_address
label_desc: Use image node_id 1 to create a new ResourceSpec object  with example: obj = ResourceSpec(resource_file)