forked from 0xWheatyz/SPARC
Persist job state in PostgreSQL so batch results survive API restarts #380
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
_jobsdict in the API is in-memory only. Any API restart — whether from a deploy, crash, or container reschedule — silently discards all in-progress and completed job state, making async batch results unreliable.Work
jobstable to the PostgreSQL schema (columns:job_id,status,created_at,updated_at,result_json,error)._jobsdict./jobsand/jobs/{job_id}endpoints to query PostgreSQL.Acceptance Criteria
/jobs/{job_id}returns correct status for jobs created before the restart.Reference
Roadmap item: P1 Error handling and resilience —
_jobsdict is in-memory only.Closing as already implemented. Verified in the current codebase that all acceptance criteria are met. Jobs are persisted in PostgreSQL (database.py has create_job/update_job/get_job/list_jobs, api.py uses them, schema includes jobs table). Auth tests exist in tests/test_auth.py with 17 test functions covering registration, login, protected routes, refresh, and admin access.