def METHOD_NAME(workspace):
  tf_config_json = os.environ.get("TF_CONFIG", "{}")
  print("TF_CONFIG=", tf_config_json)
  tf_config = json.loads(tf_config_json)
  cluster = tf_config.get("cluster", {})
  if cluster is None:
    print("TF_CONFIG cluster is empty")
    return
  ps_hosts = []
  worker_hosts = []
  chief_hosts = []
  node_list = []
  for key, value in cluster.items():
    if "ps" == key:
      ps_hosts = value
    elif "worker" == key:
      worker_hosts = value
    elif "chief" == key:
      chief_hosts = value
    node_list.extend(value)
  os.environ['TF_SEASTAR_ENDPOINT_MAP_PATH'] = '/tmp/'
  print("Start to gen endpoint_map file.")
  #endpoint_map_path = os.path.join(workspace, ".endpoint_map")
  endpoint_map_path = "/tmp/.endpoint_map"
  with open(endpoint_map_path, 'w') as fout:
    for node in node_list:
      host = node[0:node.index(':')]
      fout.write(node + "=" + host + ":" + DEFAULT_SEASTAR_PORT + "\n")
  os.system("ls -ltr /tmp/.endpoint_map")
  task = tf_config.get("task", {})
  if task is None:
    print("TF_CONFIG task is empty")
    return
  task_index = task['index']
  job_name = task['type']
  return ps_hosts, worker_hosts, chief_hosts, job_name, task_index