peal.web.jobs.JobStore¶
- class peal.web.jobs.JobStore[source]¶
Bases:
objectDirectory-backed store of web-demo jobs, one
job.jsonper job.Every read and write of a
job.jsongoes through a re-entrant lock and writes are atomic (.tmpthenos.replace), so the FastAPI handlers and theWorkerthread can share one store.- Parameters:
root (
str) – Jobs root directory; created if missing. Job ids are 12 hex chars and each job lives in<root>/<job_id>/.
Methods
Create a new job directory and its initial
job.json.Remove a job's whole directory (uploads, run dir, results).
Seconds until the job starts (or, for a new upload, until it would start): the running job's remaining time plus one median per job ahead.
Load a job record.
Directory of a job, validating the id format.
All readable job records under the root, oldest first.
Update a job and record when it first reached
step.Median wall-clock duration of the last
nfinished jobs.The oldest job with status
"queued", orNone.Active jobs (queued, running or awaiting feedback), oldest first.
1 = running now, 2 = next, ...; None when not active.
Queue summary shown on the landing page.
Merge
changesinto a job record and write it back atomically.- list()[source]¶
All readable job records under the root, oldest first.
Directories whose name is not a job id, or whose
job.jsonis missing or corrupt, are skipped.
- estimate_wait_seconds(job_id=None)[source]¶
Seconds until the job starts (or, for a new upload, until it would start): the running job’s remaining time plus one median per job ahead. A job waiting for verdicts counts as running: it holds the GPU.