[
https://issues.apache.org/jira/browse/AIRFLOW-1756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16219166#comment-16219166
]
Colin Son commented on AIRFLOW-1756:
------------------------------------
[~ashb]
The AWS Hook will create a boto3 client whenever you call `self.get_conn()`:
{code}
def get_client_type(self, client_type, region_name=None):
aws_access_key_id, aws_secret_access_key, region_name, endpoint_url = \
self._get_credentials(region_name)
return boto3.client(
client_type,
region_name=region_name,
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
endpoint_url=endpoint_url
)
{code}
And using `get_object` using the Boto3 Client will return a dict, and not a
boto3.S3.Key object.
> 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
>
> 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)