From 1370781e2bc3406115984aca6b2bd636838bc368 Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Mon, 4 Nov 2024 16:32:02 -0800 Subject: [PATCH] exists Signed-off-by: Yee Hing Tong --- flytekit/core/data_persistence.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flytekit/core/data_persistence.py b/flytekit/core/data_persistence.py index 751ffb8b27..7035147016 100644 --- a/flytekit/core/data_persistence.py +++ b/flytekit/core/data_persistence.py @@ -315,7 +315,11 @@ async def get(self, from_path: str, to_path: str, recursive: bool = False, **kwa return to_path except OSError as oe: logger.debug(f"Error in getting {from_path} to {to_path} rec {recursive} {oe}") - if not file_system.exists(from_path): + if isinstance(file_system, AsyncFileSystem): + exists = await file_system._exists(from_path) # pylint: disable=W0212 + else: + exists = file_system.exists(from_path) + if not exists: raise FlyteDataNotFoundException(from_path) file_system = self.get_filesystem(get_protocol(from_path), anonymous=True, asynchronous=True) if file_system is not None: