code: def test_auto_requeue_custom_signal_flag(
      auto_requeue, requeue_signal
  ):
      trainer = Trainer(
          plugins=[
              SLURMEnvironment(
                  auto_requeue=auto_requeue,
                  requeue_signal=requeue_signal,
              )
          ]
      )
      connector = _SignalConnector(trainer)
      connector.register_signal_handlers()
  
      if auto_requeue:
          sigterm_handlers = signal.getsignal(
              signal.SIGTERM
          ).signal_handlers
          assert len(sigterm_handlers) == 2
          assert (
              sigterm_handlers[1].__qualname__
              == "_SignalConnector._sigterm_handler_fn"
          )
  
          sigusr_handlers = signal.getsignal(
              requeue_signal
          ).signal_handlers
          assert len(sigusr_handlers) == 1
          assert (
              sigusr_handlers[0].__qualname__
              == "_SignalConnector._slurm_sigusr_handler_fn"
          )
      else:
          sigterm_handlers = signal.getsignal(
              signal.SIGTERM
          ).signal_handlers
          assert len(sigterm_handlers) == 1
          assert (
              sigterm_handlers[0].__qualname__
              == "_SignalConnector._sigterm_notifier_fn"
          )
  
          assert signal.getsignal(requeue_signal) is signal.SIG_DFL
  
      connector.teardown()
  
imports: import concurrent.futures
  import os
  import signal
  from unittest import mock
  from unittest.mock import Mock
  import pytest
  from lightning.fabric.plugins.environments import SLURMEnvironment
  from lightning.fabric.utilities.imports import _IS_WINDOWS
  from lightning.pytorch import Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.trainer.connectors.signal_connector import _SignalConnector
  from lightning.pytorch.utilities.exceptions import SIGTERMException
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 3 for calling a global function with example usage: test_auto_requeue_custom_signal_flag(auto_requeue, requeue_signal) without return types