update: yarn_client.py add parsed html fallback
This commit is contained in:
@@ -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
|
# Fallback path: Knox / wrapped YARN serves an HTML directory listing for
|
||||||
# every URL on the NodeManager log endpoint. Parse it and fetch each file.
|
# 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)
|
resp = _request("GET", am_container_logs, timeout=60.0, verify=verify, auth=auth)
|
||||||
if resp.status_code < 400:
|
if resp.status_code < 400:
|
||||||
parts: list[str] = []
|
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}")
|
parts.append(f"=== {filename} ===\n{file_resp.text}")
|
||||||
if parts:
|
if parts:
|
||||||
return "\n\n".join(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)
|
raise _logs_unavailable_error(application_id)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user