Add per-Connection ssl_verify / ssl_ca_bundle plus global defaults so CDH 5 / on-prem clusters with self-signed certs or custom CA bundles can be queried without patching code. - Connection gets ssl_verify (bool|None) and ssl_ca_bundle (str|None) - Settings gets ssl_verify_default and ssl_ca_bundle_default - New YarnClientConfig dataclass carries the resolved verify= value - _request passes verify= through to httpx.request - All public yarn_client functions now take YarnClientConfig instead of a bare yarn_rm_url string; tool call sites resolve the Connection - SaveConnectionRequest exposes the two new fields Tests cover per-connection CA bundle, per-connection verify=False, global default fallback, and connection-not-found error.
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
# coding=utf-8
|
|
"""
|
|
@Time :2026/6/26
|
|
@Author :tao.chen
|
|
"""
|
|
import json
|
|
|
|
from common.logging import logger
|
|
from spark_executor.core.job_store import JobStore
|
|
from spark_executor.core.yarn_client import YarnClientConfig, get_application_status
|
|
from spark_executor.tools.connections import store as conn_store
|
|
from spark_executor.models import JobResult
|
|
|
|
store = JobStore()
|
|
|
|
|
|
def get_job_result(job_id: str) -> JobResult:
|
|
logger.debug(f"get_job_result enter job_id={job_id}")
|
|
job = store.get(job_id)
|
|
if job is None:
|
|
raise KeyError(f"Unknown job_id: {job_id}")
|
|
conn = conn_store.get(job.connection)
|
|
if conn is None:
|
|
raise KeyError(f"Connection not found: {job.connection}")
|
|
config = YarnClientConfig.from_connection(conn)
|
|
state, raw = get_application_status(job.application_id, config)
|
|
app = json.loads(raw).get("app", {})
|
|
result = JobResult(
|
|
application_id=job.application_id,
|
|
state=state,
|
|
final_status=app.get("finalStatus"),
|
|
diagnostics=app.get("diagnostics"),
|
|
tracking_url=app.get("trackingUrl"),
|
|
started_time=app.get("startedTime"),
|
|
finished_time=app.get("finishedTime"),
|
|
)
|
|
logger.info(
|
|
f"get_job_result ok job_id={job_id} application_id={job.application_id} "
|
|
f"state={state} final_status={result.final_status}"
|
|
)
|
|
return result
|