code: def test_failing_op(self):
      def create_failing_net(throw_exception):
          net = core.Net("failing_net")
          if throw_exception:
              net.ThrowException([], [])
          else:
              net.Fail([], [])
          net.Proto().type = "async_scheduling"
          return net
  
      workspace.ResetWorkspace()
      net = create_failing_net(throw_exception=True)
      workspace.CreateNet(net)
      with self.assertRaises(RuntimeError):
          workspace.RunNet(net)
  
      with self.assertRaises(RuntimeError):
          workspace.RunNet(net, allow_fail=True)
  
      workspace.ResetWorkspace()
      net = create_failing_net(throw_exception=False)
      workspace.CreateNet(net)
  
      with self.assertRaises(RuntimeError):
          workspace.RunNet(net)
  
      res = workspace.RunNet(net, allow_fail=True)
      self.assertFalse(res)
  
file_path: pytorch/caffe2/python/test/executor_test.py
imports: from caffe2.python import core, workspace
  from caffe2.python.test.executor_test_util import build_conv_model, build_resnet50_dataparallel_model, run_resnet50_epoch, ExecutorTestBase, executor_test_settings, executor_test_model_names
  from caffe2.python.test_util import TestCase
  from hypothesis import given
  import hypothesis.strategies
  import unittest
label_desc: Use image node_id 1 for calling the ExecutorFailingOpTest obj's underlying member method code with example usage: obj.test_failing_op() and returns: net