-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Closed
Labels
area:providersgood first issuekind:bugThis is a clearly a bugThis is a clearly a bugprovider:googleGoogle (including GCP) related issuesGoogle (including GCP) related issues
Description
Apache Airflow Provider(s)
Versions of Apache Airflow Providers
10.15.0
Apache Airflow version
2.6.3
Operating System
Debian
Deployment
Google Cloud Composer
Deployment details
No response
What happened
When using GCSToLocalFilesystemOperator on a non-existing object, the resulted exception is regarding a NoneType object with no size attribute - which is True, but it would be better to raise an exception that the file simply does not exist.
What you think should happen instead
No response
How to reproduce
Use the GCSToLocalFilesystemOperator with a non-existing OBJECT_NAME
gcs_to_fs = GCSToLocalFilesystemOperator(
task_id="gcs_to_fs",
bucket=BUCKET, # <- exists
object_name=OBJECT_NAME, # <- does not exist
)You'll get an exception similar to this:
Traceback (most recent call last):
File "/opt/python3.11/lib/python3.11/site-packages/airflow/providers/google/cloud/transfers/gcs_to_local.py", line 118, in execute
file_size = hook.get_size(bucket_name=self.bucket, object_name=self.object_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python3.11/lib/python3.11/site-packages/airflow/providers/google/cloud/hooks/gcs.py", line 968, in get_size
blob_size = blob.size
^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'size'
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
area:providersgood first issuekind:bugThis is a clearly a bugThis is a clearly a bugprovider:googleGoogle (including GCP) related issuesGoogle (including GCP) related issues