CAS and new job-running #2418
johnjosephhorton
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Plan: Streaming CAS Writes During Job Execution
Context
Currently, the runner builds a complete
Resultsobject after all interviews finish (build_edsl_results), then serializes it to CAS in one shot viato_jsonl_rows()→CASRepository.save(). This means:The idea is to stream results into the CAS directory incrementally — writing new blobs and updating the tree/commit as each interview completes, moving HEAD forward progressively. This gives crash recovery, lower peak memory, and progressive persistence.
Current Architecture (relevant pieces)
CAS Structure (per object UUID)
Results JSONL Format
Runner Flow
Design: Streaming CAS Writer
Core Idea
Introduce a
StreamingCASWriterthat:n_resultscount (or we handle this differently — see options below)The n_results / Manifest Problem
The JSONL format's Line 2 (manifest) declares
n_resultsandn_cache_linesupfront. With streaming, we don't know the final count until the job finishes. Options:Option A: Placeholder manifest, rewrite at end
n_results: 0initiallyfrom_jsonlOption B: Don't use n_results for parsing — use sentinel/structure
from_jsonlto not rely onn_results— just read all lines after the survey+cache section as resultsn_survey_linesandn_cache_lines, which are fixed at job start, so the result section boundary is knownn_resultsbecomes informational onlyfrom_jsonl(but it's already close — it useslines[result_start:])Option B is strongly preferred — it makes every commit a valid checkpoint.
Key Integration Points
1.
StreamingCASWriterclass (new, inedsl/object_store/)2. Hook into
on_task_completed→ interview completionIn
JobService.on_task_completed()(line 838), when an interview transitions out of RUNNING state, the streaming writer gets notified:3. Preamble written at job submission
In
Runner.submit()orJobService.submit_job(), after the survey is known:4.
from_jsonlcompatibilityCurrently
from_jsonlalready doeslines[result_start:]— it doesn't actually usen_resultsfor slicing. So intermediate commits are already loadable as-is. We'd just want to maken_resultsin the header informational (or update it on finalize).Commit History Example
Each commit is a valid, loadable Results object with however many interviews have completed so far.
git log-like history shows the run's progress.Blob Deduplication Benefits
Performance Considerations
backend.write()per new result row (~1KB each). Negligible vs LLM call time.backend.write()per commit. Atomic on filesystem.Batching Option
For high-throughput jobs (thousands of interviews), we could batch: accumulate N completed results, then commit once. The writer could have a
flush_intervalorbatch_sizeparameter.Files to Modify
edsl/object_store/streaming_writer.pyStreamingCASWriterclassedsl/object_store/__init__.pyedsl/runner/runner.pyedsl/runner/service.pycas_writer.append_result()edsl/results/results_serializer.pyfrom_jsonldoesn't depend onn_resultsfor correctness (already the case)What This Does NOT Change
to_jsonl()/from_jsonl()round-trip — fully preservedObjectStore.save()path — still works for after-the-fact savesbuild_edsl_results()method — still used for the in-memory Results return valueOpen Questions
ObjectStore.list()shows in-progress runs.Verification
StreamingCASWriter, write preamble, append 5 results, verify each intermediate commit loads as valid Results viafrom_jsonlBeta Was this translation helpful? Give feedback.
All reactions