docstr: Tests retrieving checkpoint directories from a given root directory
docstr_tok: ["Tests","retrieving","checkpoint","directories","from","a","given","root","directory"]
code: def test_retrieve_checkpoint_dirpaths(self) -> None:
      """
      Tests retrieving checkpoint directories from a given root directory
      """
      with tempfile.TemporaryDirectory() as temp_dir:
          paths = [
              "epoch_0_step_10",
              "epoch_1_step_10",
              "epoch_2_step_10",
              "epoch_0_step_5",
              "epoch_0_step_6",
              "epoch_0_step_3",
          ]
          for path in paths[:-1]:
              os.mkdir(os.path.join(temp_dir, path))
          # make last path a file instead of a directory
          with open(os.path.join(temp_dir, paths[-1]), "w"):
              pass
  
          # compares set equality since order of returned dirpaths is not guaranteed
          # in _retrieve_checkpoint_dirpaths
          self.assertEqual(
              set(
                  _retrieve_checkpoint_dirpaths(
                      temp_dir, metadata_fname=None
                  )
              ),
              {os.path.join(temp_dir, path) for path in paths[:-1]},
          )
          self.assertEqual(
              _retrieve_checkpoint_dirpaths(
                  temp_dir, metadata_fname=".metadata"
              ),
              [],
          )
  
          # check metadata file is correct filtered for
          # by creating metadata for 3rd path in list
          with open(os.path.join(temp_dir, paths[2], ".metadata"), "w"):
              pass
  
          self.assertEqual(
              set(
                  _retrieve_checkpoint_dirpaths(
                      temp_dir, metadata_fname=".metadata"
                  )
              ),
              {os.path.join(temp_dir, paths[2])},
          )
  
imports: import os
  import shutil
  import tempfile
  import unittest
  import torch
  import torch.distributed
  from torch import nn
  from torch.distributed import launcher
  from torchsnapshot import Snapshot
  from torchsnapshot.snapshot import SNAPSHOT_METADATA_FNAME
  from torchtnt.framework._test_utils import DummyTrainUnit, get_dummy_train_state
  from torchtnt.framework.callbacks._checkpoint_utils import _delete_checkpoint, _metadata_exists, _prepare_app_state_for_checkpoint, _retrieve_checkpoint_dirpaths, get_checkpoint_dirpaths, get_latest_checkpoint_path, rank_zero_read_and_broadcast
  from torchtnt.utils.distributed import get_global_rank, PGWrapper
  from torchtnt.utils.env import init_from_env
  from torchtnt.utils.fsspec import get_filesystem
  from torchtnt.utils.test_utils import get_pet_launch_config, spawn_multi_process
label_desc: Use image node_id 5 for calling the CheckpointUtilsTest obj's underlying member method code with example usage: obj.test_retrieve_checkpoint_dirpaths() without return types