You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/03 14:43:19 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #21295: Use temporary file in GCSToS3Operator

mik-laj commented on a change in pull request #21295:
URL: https://github.com/apache/airflow/pull/21295#discussion_r798633735



##########
File path: airflow/providers/amazon/aws/transfers/gcs_to_s3.py
##########
@@ -164,14 +165,18 @@ def execute(self, context: 'Context') -> List[str]:
         if files:
 
             for file in files:
-                file_bytes = hook.download(object_name=file, bucket_name=self.bucket)
-
-                dest_key = self.dest_s3_key + file
-                self.log.info("Saving file to %s", dest_key)
-
-                s3_hook.load_bytes(
-                    file_bytes, key=dest_key, replace=self.replace, acl_policy=self.s3_acl_policy
-                )
+                with NamedTemporaryFile() as local_tmp_file:
+                    hook.download(object_name=file, bucket_name=self.bucket, filename=local_tmp_file.name)

Review comment:
       What do you think about `GCSHook.provide_file`?




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org