21 lines
627 B
Python
21 lines
627 B
Python
# coding=utf-8
|
|
"""
|
|
@Time :2026/6/24
|
|
@Author :tao.chen
|
|
"""
|
|
from common.logging import logger
|
|
from spark_executor.core.job_store import JobStore
|
|
from spark_executor.core.yarn_client import get_application_status
|
|
from spark_executor.models import JobStatus
|
|
|
|
store = JobStore()
|
|
|
|
|
|
def get_job_status(job_id: str) -> JobStatus:
|
|
job = store.get(job_id)
|
|
if job is None:
|
|
raise KeyError(f"Unknown job_id: {job_id}")
|
|
state, raw = get_application_status(job.application_id)
|
|
logger.info(f"get_job_status job_id={job_id} state={state}")
|
|
return JobStatus(application_id=job.application_id, state=state, raw=raw)
|