code: def testListDevicesClusterSpecPropagation(self):
      server1 = server_lib.Server.create_local_server()
      server2 = server_lib.Server.create_local_server()
  
      cluster_def = cluster_pb2.ClusterDef()
      job = cluster_def.job.add()
      job.name = "worker"
      job.tasks[0] = server1.target[len("grpc://") :]
      job.tasks[1] = server2.target[len("grpc://") :]
      config = config_pb2.ConfigProto(cluster_def=cluster_def)
      with session.Session(server1.target, config=config) as sess:
          devices = sess.list_devices()
          device_names = set(d.name for d in devices)
          self.assertTrue(
              "/job:worker/replica:0/task:0/device:CPU:0"
              in device_names
          )
          self.assertTrue(
              "/job:worker/replica:0/task:1/device:CPU:0"
              in device_names
          )
          # All valid device incarnations must be non-zero.
          self.assertTrue(all(d.incarnation != 0 for d in devices))
  
file_path: tensorflow-upstream/tensorflow/python/client/session_list_devices_test.py
imports: from tensorflow.core.protobuf import cluster_pb2
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.python.client import pywrap_tf_session
  from tensorflow.python.client import session
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.platform import googletest
  from tensorflow.python.training import server_lib
label_desc: Use image node_id 4 for calling the SessionListDevicesTest obj's underlying member method code with example usage: obj.testListDevicesClusterSpecPropagation() without return types