class_docstr: A thread that polls the state of a TPU node.
  
  When the node transitions into a TERMINAL state (PREEMPTED, TERMINATED)
  that's considered as not recoverable by the underlying infrastructure,
  it attempts to close the session, and exits the entire process if the
  session.close() stucks.
class_docstr_tok: ["A","thread","that","polls","the","state","of","a","TPU","node",".","When","the","node","transitions","into","a","TERMINAL","state","(","PREEMPTED",",","TERMINATED",")","that","'s","considered","as","not","recoverable","by","the","underlying","infrastructure",",","it","attempts","to","close","the","session",",","and","exits","the","entire","process","if","the","session.close","(",")","stucks","."]
code: def __init__(self, cluster, session):
      super(_TPUPollingThread, self).__init__()
  
      self.daemon = True
      self._running = True
      self._session_closed = False
      self._cluster = cluster
      self._session = session
      self._interval = 30
  
      # Some of the Google API libraries are quite chatty, so disable them.
      for name in ["googleapiclient.discovery", "oauth2client.client"]:
          _logging.getLogger(name).setLevel(_logging.WARNING)
  
file_path: tensorflow-upstream/tensorflow/python/tpu/preempted_hook.py
imports: import logging
  import os
  import threading
  import time
  from tensorflow.python.distribute.cluster_resolver import tpu_cluster_resolver
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.training import session_run_hook
label_desc: Use image node_id 1 to create a new _TPUPollingThread object from inherited base classes: threading with example: obj = _TPUPollingThread(cluster, session)