From 81c53fdaecaa39b97fc06ee91a53f347685f134d Mon Sep 17 00:00:00 2001 From: Ethan Harris Date: Thu, 15 Sep 2022 15:58:07 +0100 Subject: [PATCH] Invalid cache before listing drive when collecting component names (#13971) Co-authored-by: thomas chaton Co-authored-by: Jirka Borovec --- src/lightning_app/storage/drive.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lightning_app/storage/drive.py b/src/lightning_app/storage/drive.py index f72ad38b6e..d413e93bb9 100644 --- a/src/lightning_app/storage/drive.py +++ b/src/lightning_app/storage/drive.py @@ -260,6 +260,9 @@ class Drive: def _collect_component_names(self) -> List[str]: sep = "/" if self.fs.exists(self.drive_root): + # Invalidate cache before running ls in case new directories have been added + # TODO: Re-evaluate this - may lead to performance issues + self.fs.invalidate_cache() return [str(p.split(sep)[-1]) for p in self.fs.ls(self.drive_root)] return []