XD-DENG opened a new issue #15005:
URL: https://github.com/apache/airflow/issues/15005


   `GCSToLocalFilesystemOperator` in 
`airflow/providers/google/cloud/transfers/gcs_to_local.py` checks the file size 
if `store_to_xcom_key` is `True`.
   
   
https://github.com/apache/airflow/blob/b40dffa08547b610162f8cacfa75847f3c4ca364/airflow/providers/google/cloud/transfers/gcs_to_local.py#L137-L142
   
   How it checks size is to download the object as `bytes` then check the size. 
This unnecessarily download the objects, because 
`google.cloud.storage.blob.Blob` itself already has a `size` property 
([documentation 
reference](https://googleapis.dev/python/storage/1.30.0/blobs.html#google.cloud.storage.blob.Blob.size)).
   
   In extreme cases, if the object is big size, it adds unnecessary burden on 
the instance resources.
   
   A new method, `object_size()`, can be added to `GCSHook`, then this can be 
addressed in `GCSToLocalFilesystemOperator`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to