Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible this file should be extracted to a separated PR since core and providers don't have the same release cycle

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amoghrajesh This sort of change (needing this in the provider for it to be functional) was exactly the sort of thing I wanted us to look at

Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,25 @@ def _default_conn_name_from(mod_path, hook_name):
)
_handler_kwargs = {}
elif remote_base_log_folder.startswith("stackdriver://"):
from airflow.providers.google.cloud.log.stackdriver_task_handler import StackdriverRemoteLogIO

key_path = conf.get_mandatory_value("logging", "GOOGLE_KEY_PATH", fallback=None)
# stackdriver:///airflow-tasks => airflow-tasks
log_name = urlsplit(remote_base_log_folder).path[1:]
STACKDRIVER_REMOTE_HANDLERS = {
"task": {
"class": "airflow.providers.google.cloud.log.stackdriver_task_handler.StackdriverTaskHandler",
"formatter": "airflow",
"gcp_log_name": log_name,
"gcp_key_path": key_path,
}
}

DEFAULT_LOGGING_CONFIG["handlers"].update(STACKDRIVER_REMOTE_HANDLERS)
REMOTE_TASK_LOG = StackdriverRemoteLogIO(
**cast(
"dict[str, Any]",
{
"base_log_folder": BASE_LOG_FOLDER,
"gcp_log_name": log_name,
"gcp_key_path": key_path,
"delete_local_copy": delete_local_copy,
}
| _handler_kwargs,
)
)
_handler_kwargs = {}
elif remote_base_log_folder.startswith("oss://"):
from airflow.providers.alibaba.cloud.log.oss_task_handler import OSSRemoteLogIO

Expand Down
Loading
Loading