Module Contents



WasbTaskHandler is a python log handler that handles and reads task instance logs.

class, wasb_log_folder, wasb_container, *, filename_template=None, **kwargs)[source]

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

WasbTaskHandler is a python log handler that handles and reads task instance logs.

It extends airflow FileTaskHandler and uploads to and reads from Wasb remote storage.

trigger_should_wrap = True[source]

Return WasbHook.

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.

  • 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 and upload local log file to remote storage Wasb.


Check if remote_log_location exists in remote storage.


remote_log_location (str) – log’s location in remote storage


True if location exists else False

Return type


wasb_read(remote_log_location, return_error=False)[source]

Return the log found at the remote_log_location. Returns ‘’ if no logs are found or there is an error.

  • remote_log_location (str) – the log’s location in remote storage

  • return_error (bool) – if True, returns a string error message if an error occurs. Otherwise returns ‘’ when an error occurs.

wasb_write(log, remote_log_location, append=True)[source]

Write the log to the remote_log_location. Fails silently if no hook was created.

  • log (str) – the log to write to the remote_log_location

  • remote_log_location (str) – the log’s location in remote storage

  • append (bool) – if False, any existing log file is overwritten. If True, the new log is appended to any existing logs.

Was this entry helpful?