[ 
https://issues.apache.org/jira/browse/AIRFLOW-1756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16246508#comment-16246508
 ] 

ASF subversion and git services commented on AIRFLOW-1756:
----------------------------------------------------------

Commit 1f417efc8c88ac68f343e6a30ec11b98ea15eced in incubator-airflow's branch 
refs/heads/v1-9-test from [~ashb]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-airflow.git;h=1f417ef ]

[AIRFLOW-1756] Fix S3TaskHandler to work with Boto3-based S3Hook

The change from boto2 to boto3 in S3Hook caused
this to break (the
return type of `hook.get_key()` changed. There's a
better method
designed for that we should use anyway.

This wasn't caught by the tests as the mocks
weren't updated. Rather
than mocking the return of the hook I have changed
it to use "moto"
(already in use elsewhere in the tests) to mock at
the S3 layer, not
our hook.

Closes #2773 from ashb/AIRFLOW-1756-s3-logging-
boto3-fix

(cherry picked from commit 715602ce6a78d773ca85397cf8a0fa85afe42b74)
Signed-off-by: Bolke de Bruin <bo...@xs4all.nl>


> S3 Task Handler Cannot Read Logs With New S3Hook
> ------------------------------------------------
>
>                 Key: AIRFLOW-1756
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1756
>             Project: Apache Airflow
>          Issue Type: Bug
>    Affects Versions: 1.9.0
>            Reporter: Colin Son
>            Priority: Critical
>             Fix For: 1.9.0
>
>
> With the changes to the S3Hook, it seems like it cannot read the S3 task logs.
> In the `s3_read` in the S3TaskHandler.py:
> {code}
> s3_key = self.hook.get_key(remote_log_location)
> if s3_key:
>     return s3_key.get_contents_as_string().decode()
> {code}
> Since the s3_key object is now a dict, you cannot call 
> `get_contents_as_string()` on a dict object. You have to use the S3Hook's 
> `read_key()` method to read the contents of the task logs now. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to