mtsadler-branch commented on issue #45395: URL: https://github.com/apache/airflow/issues/45395#issuecomment-2607565850
Here's a helper function for anyone running into this issue while calling `TaskInstance.log_url` directly: ```python def get_log_url(context): """ Get the log URL for the task instance. Args: context: Airflow context object Returns: str: The log URL for the task instance """ from urllib import parse task_instance = context["ti"] parsed_url = parse.urlparse(task_instance.log_url) base_url = f"{parsed_url.scheme}://{parsed_url.netloc}" attrs = { "dag_id": task_instance.dag_id, "task_id": task_instance.task_id, "execution_date": task_instance.execution_date, } formatted_attrs = parse.urlencode(attrs) formatted_attrs += f"&map_index={task_instance.map_index}" if task_instance.map_index >= 0 else "" log_url = f"{base_url}/log?{formatted_attrs}" return log_url ``` Ie. `log_url = context.get("task_instance").log_url` would become `log_url = get_log_url(context)` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org