Created
October 4, 2020 23:32
-
-
Save mik-laj/f94e9940bfd3f08cf69287ac62652bc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy | |
from airflow.config_templates.airflow_local_settings import DEFAULT_LOGGING_CONFIG | |
from urllib.parse import urlparse | |
from pprint import pprint | |
from airflow.configuration import conf | |
LOGGING_CONFIG = deepcopy(DEFAULT_LOGGING_CONFIG) | |
REMOTE_BASE_LOG_FOLDER: str = conf.get('core', 'REMOTE_BASE_LOG_FOLDER') | |
key_path = conf.get('core', 'GOOGLE_KEY_PATH', fallback=None) | |
# stackdriver:///airflow-tasks => airflow-tasks | |
log_name = urlparse(REMOTE_BASE_LOG_FOLDER).path[1:] | |
LOGGING_CONFIG['handlers']['task'] = { | |
'class': 'stackdriver.StackdriverTaskHandler', | |
'formatter': 'airflow', | |
'name': log_name, | |
'gcp_key_path': key_path | |
} | |
pprint(LOGGING_CONFIG) | |
# AIRFLOW__LOGGING__LOGGING_CONFIG_CLASS=log_config.LOGGING_CONFIG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment