blob: 73985da021a2203b099863dd37e88e1d462dbd2c [file] [log] [blame]
:py:mod:`airflow.providers.amazon.aws.log.s3_task_handler`
==========================================================
.. py:module:: airflow.providers.amazon.aws.log.s3_task_handler
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.amazon.aws.log.s3_task_handler.S3TaskHandler
.. py:class:: S3TaskHandler(base_log_folder, s3_log_folder, filename_template = None)
Bases: :py:obj:`airflow.utils.log.file_task_handler.FileTaskHandler`, :py:obj:`airflow.utils.log.logging_mixin.LoggingMixin`
S3TaskHandler is a python log handler that handles and reads
task instance logs. It extends airflow FileTaskHandler and
uploads to and reads from S3 remote storage.
.. py:method:: hook(self)
Returns S3Hook.
.. py:method:: set_context(self, ti)
Provide task_instance context to airflow task handler.
:param ti: task instance object
.. py:method:: close(self)
Close and upload local log file to remote storage S3.
.. py:method:: s3_log_exists(self, remote_log_location)
Check if remote_log_location exists in remote storage
:param remote_log_location: log's location in remote storage
:return: True if location exists else False
.. py:method:: s3_read(self, remote_log_location, return_error = False)
Returns the log found at the remote_log_location. Returns '' if no
logs are found or there is an error.
:param remote_log_location: the log's location in remote storage
:param return_error: if True, returns a string error message if an
error occurs. Otherwise returns '' when an error occurs.
:return: the log found at the remote_log_location
.. py:method:: s3_write(self, log, remote_log_location, append = True, max_retry = 1)
Writes the log to the remote_log_location. Fails silently if no hook
was created.
:param log: the log to write to the remote_log_location
:param remote_log_location: the log's location in remote storage
:param append: if False, any existing log file is overwritten. If True,
the new log is appended to any existing logs.
:param max_retry: Maximum number of times to retry on upload failure