feat: setup dataset enrichment app codebase and scripts
This commit is contained in:
1 parent
b5c28cc98a
commit
d07578462e
72 files changed
+11370
No files matched your search
@@ -0,0 +1,29 @@
|
||||
"""Job routes (REQ-070, REQ-071)."""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
|
||||
from backend import jobs as job_store
|
||||
|
||||
router = APIRouter(prefix="/api/jobs", tags=["jobs"])
|
||||
|
||||
|
||||
@router.get("")
|
||||
def list_jobs(project_id: Optional[int] = None, limit: int = 50) -> dict:
|
||||
return {"jobs": [job.to_dict() for job in job_store.listing(project_id, limit)]}
|
||||
|
||||
|
||||
@router.get("/{job_id}")
|
||||
def get_job(job_id: int) -> dict:
|
||||
job = job_store.get(job_id)
|
||||
if job is None:
|
||||
raise HTTPException(404, "No such job")
|
||||
return job.to_dict()
|
||||
|
||||
|
||||
@router.post("/{job_id}/cancel")
|
||||
def cancel_job(job_id: int) -> dict:
|
||||
if not job_store.cancel(job_id):
|
||||
raise HTTPException(400, "Job is not cancellable")
|
||||
return {"ok": True}
|
||||
Reference in new issue
Block a user