docstr: This tests that save and restore are commutative.
docstr_tok: ["This","tests","that","save","and","restore","are","commutative","."]
code: def testFunctionRecurringSave(self):
      """This tests that save and restore are commutative."""
  
      def train_fn(config):
          for step in range(10):
              with tempfile.TemporaryDirectory() as temp_checkpoint_dir:
                  if step % 3 == 0:
                      path = os.path.join(
                          temp_checkpoint_dir, "checkpoint.json"
                      )
                      with open(path, "w") as f:
                          json.dump({"step": step}, f)
                  ray.train.report(
                      dict(test=step),
                      checkpoint=Checkpoint.from_directory(
                          temp_checkpoint_dir
                      ),
                  )
  
      new_trainable = self.create_trainable(train_fn)
      new_trainable.train()
      checkpoint_obj = new_trainable.save()
      new_trainable.restore(checkpoint_obj)
      checkpoint = new_trainable.save()
  
      new_trainable.stop()
  
      new_trainable2 = self.create_trainable(train_fn)
      new_trainable2.restore(checkpoint)
      new_trainable2.train()
      new_trainable2.stop()
  
imports: import json
  import os
  import sys
  import shutil
  import tempfile
  import unittest
  import ray
  from ray.air.constants import TRAINING_ITERATION
  from ray.rllib import _register_all
  import ray.train
  from ray import tune
  from ray.train import Checkpoint, CheckpointConfig
  from ray.tune.logger import NoopLogger
  from ray.tune.execution.placement_groups import PlacementGroupFactory
  from ray.tune.trainable import with_parameters, wrap_function
  from ray.tune.result import DEFAULT_METRIC
  from ray.tune.schedulers import ResourceChangingScheduler
  from ray.train.tests.util import mock_storage_context
label_desc: Use image node_id 5 for calling the FunctionCheckpointingTest obj's underlying member method code with example usage: obj.testFunctionRecurringSave() without return types