code: def checkpoint_and_try_requeue(
      self, signum: int, frame: tp.Optional[types.FrameType] = None
  ) -> None:
      timed_out = self.has_timed_out()
      case = "timed-out" if timed_out else "preempted"
      self._logger.warning(
          f"Caught signal {signal.Signals(signum).name} on {socket.gethostname()}: this job is {case}."
      )
  
      procid = self.env.global_rank
      if procid != 0:
          self._logger.info(
              f"Not checkpointing nor requeuing since I am a slave (procid={procid})."
          )
          # do not sys.exit, because it might kill the master task
          return
  
      delayed = self._delayed
      countdown = delayed._timeout_countdown - timed_out
      no_requeue_reason = ""
      if hasattr(delayed.function, "checkpoint"):
          no_requeue_reason = _checkpoint(
              delayed, self._job_paths.submitted_pickle, countdown
          )
      elif timed_out:
          no_requeue_reason = "timed-out and not checkpointable"
      if countdown < 0:  # this is the end
          no_requeue_reason = "timed-out too many times"
      if no_requeue_reason:
          # raise an error so as to create "result_pickle" file which notifies the job is over
          # this is caught by the try/except in "process_job"
          message = f"Job not requeued because: {no_requeue_reason}."
          self._logger.info(message)
          raise utils.UncompletedJobError(message)
      # if everything went well, requeue!
      self.env._requeue(countdown)
      self._exit()
  
imports: import os
  import signal
  import socket
  import sys
  import time
  import types
  import typing
  from pathlib import Path
  from .None import logger, utils
  from .utils import DelayedSubmission, JobPaths
label_desc: Use image node_id 4 for calling the SignalHandler obj's underlying member method code with example usage: obj.checkpoint_and_try_requeue(signum, frame) without return types