class_docstr: Google TPU accelerators.
docstr: Return the worker index of the TPU pod.
docstr_tok: ["Return","the","worker","index","of","the","TPU","pod","."]
code: def _get_current_node_tpu_worker_id() -> Optional[int]:
      """Return the worker index of the TPU pod."""
      try:
          # Start with GKE-based check
          worker_id = os.getenv(GKE_TPU_WORKER_ID_ENV_VAR, None)
          if not worker_id:
              # GCE-based VM check
              worker_id = _get_tpu_metadata(key=GCE_TPU_WORKER_ID_KEY)
          if worker_id:
              return int(worker_id)
          else:
              return None
      except ValueError as e:
          logging.debug("Could not get TPU worker id: %s", e)
          return None
  
imports: import os
  import re
  import glob
  import requests
  import logging
  from typing import Dict, Optional, List, Tuple
  from ray._private.accelerators.accelerator import AcceleratorManager
label_desc: Use image node_id 10 for calling the TPUAcceleratorManager obj's underlying member method code with example usage: obj._get_current_node_tpu_worker_id() and returns: int, None, None