airflow.providers.apache.hdfs.log.hdfs_task_handler

Classes

HdfsRemoteLogIO

Convenience super-class to have a logger configured with the class name.

HdfsTaskHandler

HdfsTaskHandler is a Python logging handler that handles and reads task instance logs.

Module Contents

class airflow.providers.apache.hdfs.log.hdfs_task_handler.HdfsRemoteLogIO(context=None)[source]

Bases: airflow.utils.log.logging_mixin.LoggingMixin

Convenience super-class to have a logger configured with the class name.

remote_base: str[source]
base_log_folder: pathlib.Path[source]
delete_local_copy: bool[source]
processors = ()[source]
upload(path, ti)[source]

Upload the given log path to the remote storage.

property hook[source]

Returns WebHDFSHook.

read(relative_path, ti)[source]
class airflow.providers.apache.hdfs.log.hdfs_task_handler.HdfsTaskHandler(base_log_folder, hdfs_log_folder, **kwargs)[source]

Bases: airflow.utils.log.file_task_handler.FileTaskHandler, airflow.utils.log.logging_mixin.LoggingMixin

HdfsTaskHandler is a Python logging handler that handles and reads task instance logs.

It extends airflow FileTaskHandler and uploads to and reads from HDFS.

handler: logging.FileHandler | None = None[source]
remote_base[source]
log_relative_path = ''[source]
closed = False[source]
upload_on_close = True[source]
io[source]
set_context(ti, *, identifier=None)[source]

Provide task_instance context to airflow task handler.

Generally speaking returns None. But if attr maintain_propagate has been set to propagate, then returns sentinel MAINTAIN_PROPAGATE. This has the effect of overriding the default behavior to set propagate to False whenever set_context is called. At time of writing, this functionality is only used in unit testing.

Parameters:
  • ti (airflow.models.taskinstance.TaskInstance) – task instance object

  • identifier (str | None) – if set, adds suffix to log file. For use when relaying exceptional messages to task logs from a context other than task or trigger run

close()[source]

Close and upload local log file to HDFS.

Was this entry helpful?