code: def read_executor_id():
      """Read worker id from a local file in the executor's current working directory"""
      if os.path.isfile("executor_id"):
          with open("executor_id", "r") as f:
              return int(f.read())
      else:
          msg = (
              "No executor_id file found on this node, please ensure that:\n"
              + "1. Spark num_executors matches TensorFlow cluster_size\n"
              + "2. Spark tasks per executor is 1\n"
              + "3. Spark dynamic allocation is disabled\n"
              + "4. There are no other root-cause exceptions on other nodes\n"
          )
          raise Exception(msg)
  
file_path: TensorFlowOnSpark/tensorflowonspark/util.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import nested_scopes
  from __future__ import print_function
  import logging
  import os
  import socket
  import subprocess
  import errno
  from socket import error
  from .None import gpu_info
label_desc: Use image node_id 5 for calling a global function with example usage: read_executor_id() and returns: int