-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix file not found error #2079
Fix file not found error #2079
Conversation
Thank you for opening this pull request! 🙌 These tips will help get your PR across the finish line:
|
flytekit/core/data_persistence.py
Outdated
@@ -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 Exception(f"File not found in {from_path}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
raise Exception(f"File not found in {from_path}") | |
raise FlyteValueException(f"File not found in {from_path}") |
flytekit/core/context_manager.py
Outdated
@@ -365,7 +365,7 @@ def get( | |||
fpath = self.get_secrets_file(group, key, group_version) | |||
v = os.environ.get(env_var) | |||
if v is not None: | |||
return v | |||
return v.strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why removes strip()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's because of this PR.
https://github.com/flyteorg/flytekit/pull/2077/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dropped 😅
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2079 +/- ##
==========================================
+ Coverage 85.71% 85.75% +0.03%
==========================================
Files 313 313
Lines 23396 23428 +32
Branches 3501 3511 +10
==========================================
+ Hits 20055 20090 +35
+ Misses 2733 2731 -2
+ Partials 608 607 -1 ☔ View full report in Codecov by Sentry. |
0711848
to
ae24e12
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Austin Liu <[email protected]> reorder import Signed-off-by: Austin Liu <[email protected]> fix received_value Signed-off-by: Austin Liu <[email protected]>
@@ -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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to raise an error without an additional network call? e.g. are we able to check the error code (404) from oe
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not, that's fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat, but I've tried oe.errno == FileNotFoundError.errno
: and it failed to catch the 404
error.
I think it's ignorable wrt the performance issue, since it's already trapped in the exception handling process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, wait for your error code reply!
67f80b6
Congrats on merging your first pull request! 🎉 |
Tracking issue
flyteorg/flyte#4470
Why are the changes needed?
flyteorg/flyte#4470
Flytekit should raise a file not found error instead of Access denied
What changes were proposed in this pull request?
Raise an exception if the path doesn't exist on the filesystem when
dst = file_system.get(from_path, to_path, recursive=recursive, **kwargs)
catches OSError.How was this patch tested?
Setup process
minio
)Screenshots
Check all the applicable boxes
Related PRs
Docs link