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 2021/11/10 17:19:14 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #19504: Do not check for S3 key before attempting download

kaxil commented on a change in pull request #19504:
URL: https://github.com/apache/airflow/pull/19504#discussion_r746812972



##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -806,10 +806,15 @@ def download_file(
         """
         self.log.info('Downloading source S3 file from Bucket %s with path %s', bucket_name, key)
 
-        if not self.check_for_key(key, bucket_name):
-            raise AirflowException(f'The source file in Bucket {bucket_name} with path {key} does not exist')
-
-        s3_obj = self.get_key(key, bucket_name)
+        try:
+            s3_obj = self.get_key(key, bucket_name)
+        except ClientError as e:
+            if e.response.get('Error', {}).get('Code', {}) == 404:

Review comment:
       ```suggestion
               if e.response.get('Error', {}).get('Code') == 404:
   ```
   
   Should be fine I think




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