code: def get_server_def(
      job_name, local_server_port, remote_server_addresses, task_index
  ):
      """Returns a server def with a single job + multiple tasks."""
      cluster_def = cluster_pb2.ClusterDef()
      job_def = cluster_def.job.add()
      job_def.name = job_name
      job_def.tasks[0] = "localhost:%d" % local_server_port
  
      for i, remote_server_address in enumerate(
          remote_server_addresses, start=1
      ):
          job_def.tasks[i] = remote_server_address
  
      server_def = tensorflow_server_pb2.ServerDef(
          cluster=cluster_def,
          job_name=job_name,
          task_index=task_index,
          protocol="grpc",
      )
  
      return server_def
  
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.core.protobuf import cluster_pb2
  from tensorflow.core.protobuf import tensorflow_server_pb2
  from tensorflow.python import pywrap_tfe
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import remote
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import script_ops
  from tensorflow.python.platform import test
  from tensorflow.python.training import server_lib
label_desc: Use image node_id 1 for calling a global function with example usage: get_server_def(job_name, local_server_port, remote_server_addresses, task_index) and returns: server_def