code: def testBasicTrainLoopExceptionAborts(self):
      logdir = _test_dir("basic_train_loop_exception_aborts")
  
      def train_fn(unused_sess):
          train_fn.counter += 1
          if train_fn.counter == 3:
              raise RuntimeError("Failed")
  
      # Function attribute use to count the number of calls.
      train_fn.counter = 0
  
      with ops.Graph().as_default():
          sv = supervisor.Supervisor(logdir=logdir)
          with self.assertRaisesRegex(RuntimeError, "Failed"):
              basic_loops.basic_train_loop(sv, train_fn)
  
file_path: tensorflow/tensorflow/python/training/basic_loops_test.py
imports: import os
  import shutil
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.platform import test
  from tensorflow.python.training import basic_loops
  from tensorflow.python.training import supervisor
label_desc: Use image node_id 2 for calling the BasicTrainLoopTest obj's underlying member method code with example usage: obj.testBasicTrainLoopExceptionAborts() without return types