  worker = []
  port_number =40000

  filePath='./nodefile'
  with open(filePath, 'r') as f:
    nodename = f.read().splitlines()

  worker_nodes = nodename
  num_index=flags_obj.task_index

  for node in worker_nodes:
    for index in range(4):
      worker_sockets = ":".join([node, str(port_number + index )])
      worker.append(worker_sockets)
  os.environ['TF_CONFIG'] = json.dumps({
    'cluster': {
    'worker': worker
     },
    'task': {'type': 'worker', 'index': num_index}
    })
