Skip to content

Commit

Permalink
Clean WASB task handler code after bumping min Airflow version to 2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-awala committed Dec 25, 2023
1 parent a1e1dc6 commit 698fed4
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions airflow/providers/microsoft/azure/log/wasb_task_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from typing import TYPE_CHECKING, Any

from azure.core.exceptions import HttpResponseError
from packaging.version import Version

from airflow.configuration import conf
from airflow.utils.log.file_task_handler import FileTaskHandler
Expand All @@ -36,18 +35,6 @@
from airflow.models.taskinstance import TaskInstance


def get_default_delete_local_copy():
"""Load delete_local_logs conf if Airflow version > 2.6 and return False if not.
TODO: delete this function when min airflow version >= 2.6
"""
from airflow.version import version

if Version(version) < Version("2.6"):
return False
return conf.getboolean("logging", "delete_local_logs")


class WasbTaskHandler(FileTaskHandler, LoggingMixin):
"""
WasbTaskHandler is a python log handler that handles and reads task instance logs.
Expand All @@ -73,8 +60,8 @@ def __init__(
self.log_relative_path = ""
self.closed = False
self.upload_on_close = True
self.delete_local_copy = (
kwargs["delete_local_copy"] if "delete_local_copy" in kwargs else get_default_delete_local_copy()
self.delete_local_copy = kwargs.get(
"delete_local_copy", conf.getboolean("logging", "delete_local_logs")
)

@cached_property
Expand Down

0 comments on commit 698fed4

Please sign in to comment.