airflow.providers.redis.log.redis_task_handler

Module Contents

Classes

RedisTaskHandler

RedisTaskHandler is a Python log handler that handles and reads task instance logs.

class airflow.providers.redis.log.redis_task_handler.RedisTaskHandler(base_log_folder, max_lines=10000, ttl_seconds=60 * 60 * 24 * 28, conn_id=None)[source]

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

RedisTaskHandler is a Python log handler that handles and reads task instance logs.

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

Parameters
  • base_log_folder (str) – base folder to store logs locally

  • max_lines (int) – Maximum number of lines of log to store If omitted, this is 10000.

  • ttl_seconds (int) – Maximum number of seconds to store logs If omitted, this is the equivalent of 28 days.

  • conn_id (str | None) – Airflow connection ID for the Redis hook to use If omitted or None, the ID specified in the option logging.remote_log_conn_id is used.

trigger_should_wrap = True[source]
conn()[source]
set_context(ti, **kwargs)[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) – task instance object

  • identifier – 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

Was this entry helpful?