code: def test_hpc_restore_attempt(_, tmpdir):
      """Test that restore() attempts to restore the hpc_ckpt with highest priority."""
      model = BoringModel()
      trainer = Trainer(
          default_root_dir=tmpdir,
          max_steps=1,
          enable_checkpointing=False,
          logger=False,
      )
      trainer.fit(model)
  
      hpc_ckpt_path = tmpdir / "hpc_ckpt_3.ckpt"
      trainer.save_checkpoint(hpc_ckpt_path)
      assert os.listdir(tmpdir) == ["hpc_ckpt_3.ckpt"]
  
      # set weights to zero
      for param in model.parameters():
          torch.nn.init.constant_(param, 0)
  
      # case 1: restore hpc first, no explicit resume path provided
      trainer = Trainer(
          default_root_dir=tmpdir,
          max_steps=2,
          enable_checkpointing=False,
          logger=False,
      )
      trainer.fit(model)
  
      for param in model.parameters():
          assert param.abs().sum() > 0
          torch.nn.init.constant_(param, 0)
  
      # case 2: explicit resume path provided, file not found
      trainer = Trainer(default_root_dir=tmpdir, max_steps=3)
  
      with pytest.raises(
          FileNotFoundError,
          match="Checkpoint file not found: not existing",
      ):
          trainer.fit(model, ckpt_path="not existing")
  
file_path: pytorch-lightning/tests/tests_pytorch/trainer/connectors/test_checkpoint_connector.py
imports: import os
  from unittest import mock
  from unittest.mock import Mock
  import pytest
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.callbacks import ModelCheckpoint
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.trainer.states import TrainerFn
  from lightning.pytorch.utilities.migration.utils import _set_version
label_desc: Use image node_id 2 for calling a global function with example usage: test_hpc_restore_attempt(_, tmpdir) without return types