update: yarn_client.py add parsed html fallback

This commit is contained in:
Claude
2026-06-30 11:02:53 +08:00
parent 32ee167b59
commit f840791999
+5
View File
@@ -239,6 +239,8 @@ def _fetch_logs_via_am_container(application_id: str, config: YarnClientConfig)
# Fallback path: Knox / wrapped YARN serves an HTML directory listing for
# every URL on the NodeManager log endpoint. Parse it and fetch each file.
orig_resp_text = resp.text
try:
resp = _request("GET", am_container_logs, timeout=60.0, verify=verify, auth=auth)
if resp.status_code < 400:
parts: list[str] = []
@@ -249,6 +251,9 @@ def _fetch_logs_via_am_container(application_id: str, config: YarnClientConfig)
parts.append(f"=== {filename} ===\n{file_resp.text}")
if parts:
return "\n\n".join(parts)
except Exception as ex:
logger.warning(f"Parse html error: {ex}")
return orig_resp_text
raise _logs_unavailable_error(application_id)