feat: add get_job_status tool

This commit is contained in:
Claude
2026-06-24 14:43:41 +08:00
parent 63dcae8d75
commit e443f96756
2 changed files with 56 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
# 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)