forked from 0xWheatyz/SPARC
Persist async job state to PostgreSQL so batch results survive API restarts #520
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?
Context
Roadmap item: P1 Error handling and resilience
The
_jobsdictionary in the API is in-memory only. All job state is lost when the API process restarts, leaving users unable to retrieve results for in-progress or completed jobs.Task
jobstable in PostgreSQL (job_id, status, created_at, updated_at, result_json, error)_jobsdict with database queriesstatus=pending/jobs/{job_id}endpoint reads from the databaseAcceptance Criteria
jobstable exists and is created via migration or init script/jobs/{job_id}returns correct status after restartVerified complete:
database.pydefines ajobstable withjob_id,status,created_at,updated_at,result_json,errorcolumns. The in-memory_jobsdict is no longer used.mark_stale_jobs_failed()handles restart recovery. Closing as implemented.