code: def _fail_on_deadlock(self, executor):
      # If we did not recover before TIMEOUT seconds, consider that the
      # executor is in a deadlock state and forcefully clean all its
      # composants.
      import faulthandler
      from tempfile import TemporaryFile
  
      with TemporaryFile(mode="w+") as f:
          faulthandler.dump_traceback(file=f)
          f.seek(0)
          tb = f.read()
      for p in executor._processes.values():
          p.terminate()
      # This should be safe to call executor.shutdown here as all possible
      # deadlocks should have been broken.
      executor.shutdown(wait=True)
      print(f"\nTraceback:\n {tb}", file=sys.__stderr__)
      self.fail(f"Executor deadlock:\n\n{tb}")
  
imports: import contextlib
  import queue
  import signal
  import sys
  import time
  import unittest
  import unittest.mock
  from pickle import PicklingError
  from concurrent import futures
  from concurrent.futures.process import BrokenProcessPool, _ThreadWakeup
  from test import support
  from .util import create_executor_tests, setup_module, ProcessPoolForkMixin, ProcessPoolForkserverMixin, ProcessPoolSpawnMixin
label_desc: Use image node_id 1 for calling the ExecutorDeadlockTest obj's underlying member method code with example usage: obj._fail_on_deadlock(executor) without return types