class_docstr: A DirectoryWatcher wraps a loader to load from a sequence of paths.
  
  A loader reads a path and produces some kind of values as an iterator. A
  DirectoryWatcher takes a directory, a factory for loaders, and optionally a
  path filter and watches all the paths inside that directory.
  
  This class is only valid under the assumption that only one path will be
  written to by the data source at a time and that once the source stops writing
  to a path, it will start writing to a new path that's lexicographically
  greater and never come back. It uses some heuristics to check whether this is
  true based on tracking changes to the files' sizes, but the check can have
  false negatives. However, it should have no false positives.
docstr: Sets the current path to watch for new events.
  
  This also records the size of the old path, if any. If the size can't be
  found, an error is logged.
  
  Args:
    path: The full path of the file to watch.
docstr_tok: ["Sets","the","current","path","to","watch","for","new","events",".","This","also","records","the","size","of","the","old","path",",","if","any",".","If","the","size","ca","n't","be","found",",","an","error","is","logged",".","Args",":","path",":","The","full","path","of","the","file","to","watch","."]
code: def _SetPath(self, path):
      """Sets the current path to watch for new events.
  
      This also records the size of the old path, if any. If the size can't be
      found, an error is logged.
  
      Args:
        path: The full path of the file to watch.
      """
      old_path = self._path
      if old_path and not io_util.IsCloudPath(old_path):
          try:
              # We're done with the path, so store its size.
              size = tf.io.gfile.stat(old_path).length
              logger.debug(
                  "Setting latest size of %s to %d", old_path, size
              )
              self._finalized_sizes[old_path] = size
          except tf.errors.OpError as e:
              logger.error("Unable to get size of %s: %s", old_path, e)
  
      self._path = path
      self._loader = self._loader_factory(path)
  
file_path: tensorboard/tensorboard/backend/event_processing/directory_watcher.py
imports: import bisect
  from tensorboard.backend.event_processing import io_wrapper
  from tensorboard.compat import tf
  from tensorboard.util import io_util
  from tensorboard.util import tb_logging
label_desc: Use image node_id 6 for calling the DirectoryWatcher obj's underlying member method code with example usage: obj._SetPath(path) without return types