class_docstr: Store and load storages from a shared file system. Each agent should
  have this shared file system mounted in the same location defined by the
  `host_path`.
class_docstr_tok: ["Store","and","load","storages","from","a","shared","file","system",".","Each","agent","should","have","this","shared","file","system","mounted","in","the","same","location","defined","by","the","`","host_path","`","."]
docstr: Delete the stored data from persistent storage.
docstr_tok: ["Delete","the","stored","data","from","persistent","storage","."]
code: def delete(self, tgt: str, globs: List[str]) -> Dict[str, int]:
      """
      Delete the stored data from persistent storage.
      """
      storage_dir = os.path.join(self._base_path, tgt)
  
      if not os.path.exists(storage_dir):
          logger.info(
              f"Storage directory does not exist: {storage_dir}"
          )
          return {}
      if not os.path.isdir(storage_dir):
          raise errors.CheckpointNotFound(
              f"Storage path is not a directory: {storage_dir}"
          )
  
      # Optimize for the common case here. No need to iterate through files.
      if "**/*" in globs:
          util.rmtree_nfs_safe(storage_dir, ignore_errors=False)
          return {}
  
      to_delete_dirs = {}
      to_delete_files = {}
      for file_glob in globs:
          for path in glob.glob(
              f"{storage_dir}/{file_glob}", recursive=True
          ):
              if (
                  os.path.commonpath(
                      [storage_dir, os.path.normpath(path)]
                  )
                  != storage_dir
              ):
                  logger.warning(
                      f"tried to delete path outside checkpoint dir {path}"
                  )
                  continue
  
              if os.path.isfile(path) or os.path.islink(path):
                  to_delete_files[path] = True
              elif os.path.isdir(path):
                  to_delete_dirs[path] = True
  
      # Delete files first then delete paths.
      for path in to_delete_files:
          os.remove(path)
      for path in to_delete_dirs:
          util.rmtree_nfs_safe(path, ignore_errors=False)
  
      resources = self._list_directory(storage_dir)
  
      if len(resources) == 0:
          util.rmtree_nfs_safe(storage_dir, ignore_errors=False)
      return resources
  
imports: import contextlib
  import glob
  import logging
  import os
  import pathlib
  import shutil
  from typing import Any, Callable, Dict, Iterator, List, Optional, Union
  from determined import errors, util
  from determined.common import check, storage
label_desc: Use image node_id 5 for calling the SharedFSStorageManager obj's underlying member method code with example usage: obj.delete(tgt, globs) and returns: resources, dict, dict