code: def test_requeuing_checkpointable(
      tmp_path: Path, fast_forward_clock
  ) -> None:
      usr_sig = submitit.JobEnvironment._usr_sig()
      fs0 = helpers.FunctionSequence()
      fs0.add(test_core._three_time, 10)
      assert isinstance(fs0, helpers.Checkpointable)
  
      # Start job with a 60 minutes timeout
      with mocked_slurm():
          executor = slurm.SlurmExecutor(
              folder=tmp_path, max_num_timeout=1
          )
          executor.update_parameters(time=60)
          job = executor.submit(fs0)
  
      sig = get_signal_handler(job)
  
      fast_forward_clock(minutes=30)
      # Preempt the job after 30 minutes, the job hasn't timeout.
      with pytest.raises(SystemExit), mock_requeue(called_with=1):
          sig.checkpoint_and_try_requeue(usr_sig)
  
      # Restart the job.
      sig = get_signal_handler(job)
      fast_forward_clock(minutes=50)
  
      # This time the job as timed out,
      # but we have max_num_timeout=1, so we should requeue.
      # We are a little bit under the requested timedout, but close enough
      # to not consider this a preemption
      with pytest.raises(SystemExit), mock_requeue(called_with=0):
          sig.checkpoint_and_try_requeue(usr_sig)
  
      # Restart the job.
      sig = get_signal_handler(job)
      fast_forward_clock(minutes=55)
  
      # The job has already timed out twice, we should stop here.
      usr_sig = slurm.SlurmJobEnvironment._usr_sig()
      with mock_requeue(not_called=True), pytest.raises(
          utils.UncompletedJobError, match="timed-out too many times."
      ):
          sig.checkpoint_and_try_requeue(usr_sig)
  
imports: import contextlib
  import os
  import signal
  import subprocess
  import typing
  from pathlib import Path
  from unittest.mock import patch
  import pytest
  import submitit
  from ..None import helpers
  from ..core import job_environment, submission, test_core, utils
  from ..core.core import Job
  from .None import slurm
label_desc: Use image node_id 10 for calling a global function with example usage: test_requeuing_checkpointable(tmp_path, fast_forward_clock) without return types