code: def test_custom_checkpoint(tmp_path: Path) -> None:
      class Slacker(helpers.Checkpointable):
          def __call__(self, slack: bool = True):
              if slack:
                  print("Slacking", flush=True)
                  time.sleep(10)
                  raise RuntimeError("I really don't want to work")
              print("Working hard", flush=True)
              return "worked hard"
  
          def __submitit_checkpoint__(self, slack: bool = True):
              if slack:
                  print(
                      "Interrupted while slacking. I won't slack next time.",
                      flush=True,
                  )
              return utils.DelayedSubmission(self, slack=False)
  
      executor = local.LocalExecutor(tmp_path, max_num_timeout=1)
      executor.update_parameters(timeout_min=2 / 60, signal_delay_s=1)
      job = executor.submit(Slacker(True))
      job.wait()
      stdout = job.stdout()
      assert stdout
      assert "I won't slack next time." in stdout
  
imports: import functools
  import os
  import pickle
  import re
  import signal
  import sys
  import time
  from pathlib import Path
  import pytest
  from submitit import AutoExecutor
  from ..None import helpers
  from ..core import job_environment, test_core, utils
  from .None import local, test_debug
label_desc: Use image node_id 11 for calling a global function with example usage: test_custom_checkpoint(tmp_path) and returns: str, utils