feat: add in-memory JobStore

This commit is contained in:
Claude
2026-06-24 14:36:05 +08:00
parent a9f64d9942
commit 31d28baace
2 changed files with 63 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
# coding=utf-8
"""
@Time :2026/6/24
@Author :tao.chen
"""
from threading import Lock
from spark_executor.models import Job
class JobStore:
"""In-memory job registry. Stage-3 will swap this for SQLite."""
def __init__(self) -> None:
self._lock = Lock()
self._jobs: dict[str, Job] = {}
def put(self, job: Job) -> None:
with self._lock:
self._jobs[job.job_id] = job
def get(self, job_id: str) -> Job | None:
with self._lock:
return self._jobs.get(job_id)
def list(self) -> list[Job]:
with self._lock:
return list(self._jobs.values())