code: def test_resume_from_checkpoint(ray_start_4_cpus, tmpdir):
      """Test that training can be resumed from a reported checkpoint."""
  
      def train_func():
          checkpoint = train.get_checkpoint()
          if checkpoint:
              epoch = load_dict_checkpoint(checkpoint)["epoch"]
          else:
              epoch = 0
          for i in range(epoch, epoch + 2):
              with create_dict_checkpoint({"epoch": i}) as checkpoint:
                  train.report({"epoch": i}, checkpoint=checkpoint)
  
      trainer = DataParallelTrainer(
          train_loop_per_worker=train_func, scaling_config=scale_config
      )
      result = trainer.fit()
      assert load_dict_checkpoint(result.checkpoint)["epoch"] == 1
  
      trainer = DataParallelTrainer(
          train_loop_per_worker=train_func,
          scaling_config=scale_config,
          resume_from_checkpoint=result.checkpoint,
      )
      result = trainer.fit()
      assert load_dict_checkpoint(result.checkpoint)["epoch"] == 2
  
file_path: ray/python/ray/train/tests/test_data_parallel_trainer_checkpointing.py
imports: import pytest
  import ray
  from ray import train
  from ray.train import CheckpointConfig, RunConfig, ScalingConfig
  from ray.train.data_parallel_trainer import DataParallelTrainer
  from ray.train.tests.util import create_dict_checkpoint, load_dict_checkpoint
label_desc: Use image node_id 4 for calling a global function with example usage: test_resume_from_checkpoint(ray_start_4_cpus, tmpdir) without return types