code: def gen_server(
      cluster_spec, job_name: str, task_index: int, cpu_device_num: int
  ):
      """
      Start a TensorFlow server.
  
      Args:
          cluster_spec (dict): TensorFlow ClusterSpec dict
          job_name: TensorFlow job name
          task_index: TensorFlow task index
          cpu_device_num: The number of CPU devices
      """
      _clean_stale_servers()
  
      # TODO: The following config should be less hard coded ad based on strategy
      experimental = config_pb2.ConfigProto.Experimental(
          collective_nccl=True,
          collective_group_leader=DEFAULT_GROUP_LEADER,
      )
      s = Server(
          ClusterSpec(cluster_spec),
          job_name=job_name,
          task_index=task_index,
          config=config_pb2.ConfigProto(
              experimental=experimental,
              device_count={"CPU": cpu_device_num},
              inter_op_parallelism_threads=0,
              intra_op_parallelism_threads=0,
          ),
      )
      return s
  
file_path: autodist/autodist/utils/server_starter.py
imports: import argparse
  import json
  import os
  import subprocess
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.python.training.server_lib import ClusterSpec, Server
  from autodist.const import DEFAULT_WORKING_DIR, DEFAULT_GROUP_LEADER
  from autodist.utils import logging
label_desc: Use image node_id 2 for calling a global function with example usage: gen_server(cluster_spec, job_name, task_index, cpu_device_num) and returns: s