-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Refactor bucket.get_blob calls in GCSHook to handle validation for non-existent objects.
#42474
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
Conversation
…on-existing files.
|
Hi @shahar1, my PR is ready. I noticed that several methods in the GCS hook have the same issue as get_size, and some of them implemented nonexistent file checking too, so I decided to refactor those methods to reduce redundancy. Kindly check the PR when you have time. |
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.
Good start! Few comments:
- If you decide to solve the deeper cause of the original issue (which is great!) - please refer to it directly in the PR: title, content and newsfragment (i.e., fixing the issue in the hooks that tilize
get_blob, rather than the operator). It still closes the original issue though. - There are 2 failing tests due to the refactoring, try to fix these tests.
There's also an inline comment :)
GCSToLocalFilesystemOperator when reading non-existing filesbucket.get_blob calls in GCSHook to handle validation for non-existent objects.
bucket.get_blob calls in GCSHook to handle validation for non-existent objects.bucket.get_blob calls in GCSHook to handle validation for non-existent objects.
|
Great work! |
…n for non-existent objects. (apache#42474) * Fix implicit exception in GCSToLocalFilesystemOperator when reading non-existing files. * change method to internal method * Fix unit test expectations * Refactor bucket.get_blob calls in GCSHook to handle validation for non-existent objects
…n for non-existent objects. (apache#42474) * Fix implicit exception in GCSToLocalFilesystemOperator when reading non-existing files. * change method to internal method * Fix unit test expectations * Refactor bucket.get_blob calls in GCSHook to handle validation for non-existent objects
closes: #42439
related: #42439
This PR refactors
bucket.get_blobcalls inGCSHookto handle validation for non-existent objects. An internal method named_get_blobis created inGCSHookto consolidatebucket.get_blobcalls where it includes validation. Exception is raised when object is non-existent.It also fixes implicit exception in
GCSToLocalFilesystemOperatorwhen reading non-existing files by raising an explicit exception indicating object non-existence.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.