Skip to content

Commit

Permalink
add fs path exists checking (fix flyteorg/flyte#4470) (#2079)
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Liu <[email protected]>
  • Loading branch information
austin362667 authored Jan 8, 2024
1 parent 9c45cb2 commit f22cec2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flytekit/core/data_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from flytekit.configuration import DataConfig
from flytekit.core.local_fsspec import FlyteLocalFileSystem
from flytekit.core.utils import timeit
from flytekit.exceptions.user import FlyteAssertion
from flytekit.exceptions.user import FlyteAssertion, FlyteValueException
from flytekit.interfaces.random import random
from flytekit.loggers import logger

Expand Down Expand Up @@ -254,6 +254,8 @@ def get(self, from_path: str, to_path: str, recursive: bool = False, **kwargs):
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):
raise FlyteValueException(from_path, "File not found")
file_system = self.get_filesystem(get_protocol(from_path), anonymous=True)
if file_system is not None:
logger.debug(f"Attempting anonymous get with {file_system}")
Expand Down

0 comments on commit f22cec2

Please sign in to comment.