Skip to content

feat(extract): add --scope session and --slim to batch extract#222

Open
elronbandel wants to merge 2 commits into
mainfrom
extract-slim-and-sessions
Open

feat(extract): add --scope session and --slim to batch extract#222
elronbandel wants to merge 2 commits into
mainfrom
extract-slim-and-sessions

Conversation

@elronbandel

Copy link
Copy Markdown
Contributor

Why

`batch extract` today emits run-level rows with all fields including JSON-encoded blobs (`session_results`, `accumulated__report`, `_session_ids`) — the CSV is ~70 MB on a moderate run tree and not useful for downstream statistical analysis. There's also no built-in way to get per-session results in tabular form; users have been walking session dirs with ad-hoc scripts.

What

Two new options on `batch extract`:

Flag Default Meaning
`--scope run|session` `run` `run` = existing one-row-per-config behavior; `session` = one row per task, flattens each run's embedded `session_results`
`--slim` off Drop bulky/redundant fields. For run scope: `session_results`, `session_ids`, `accumulated_report`, etc. For session scope: `details`, `cost_reports`.

Impact

Same ~150-config / 12k-session tree:

CSV size
`--scope run` 70 MB
`--scope run --slim` 82 KB
`--scope session` 70 MB
`--scope session --slim` 2.4 MB

For a repo-tracked snapshot or a HuggingFace dataset:

```bash
exgentic batch extract --config "experiments///*/config.json" \
--scope run --slim --output runs.csv

exgentic batch extract --config "experiments///*/config.json" \
--scope session --slim --output sessions.csv
```

Tests

  • `test_batch_extract_slim_drops_bulky_fields`
  • `test_batch_extract_scope_session_emits_one_row_per_task`
  • `test_batch_extract_scope_session_slim_drops_json_blobs`

All 6 existing tests in `test_cli_batch.py` pass unchanged.

Compatibility

Default behavior (no flags) is byte-identical to before. `--scope` defaults to `run` and `--slim` defaults to off.

batch extract today only emits run-level rows with all fields including
JSON-encoded blobs (session_results, accumulated_*_report,
*_session_ids) — the resulting CSV is ~70 MB on a moderate run tree
and isn't useful for downstream analysis. There's also no built-in way
to get per-session results in tabular form; users were walking session
dirs with ad-hoc scripts.

Two new options on `batch extract`:

  --scope run|session  (default: run)
    run:     existing behavior — one row per config
    session: one row per task; iterates each run's embedded
             session_results and prepends config_path + run_id

  --slim
    Drop bulky/redundant fields. For run scope: session_results,
    *_session_ids, accumulated_*_report, etc. For session scope:
    details and cost_reports (the two JSON-blob fields).

Combined effect on a ~150-config / 12k-session tree:
  --scope run                 →  70 MB
  --scope run --slim          →  82 KB
  --scope session             →  70 MB
  --scope session --slim      →  2.4 MB

Tests added (3 new):
- test_batch_extract_slim_drops_bulky_fields
- test_batch_extract_scope_session_emits_one_row_per_task
- test_batch_extract_scope_session_slim_drops_json_blobs

Existing 6 tests in test_cli_batch.py pass unchanged.

Signed-off-by: Elron Bandel <elron.bandel@ibm.com>
Code already self-documents from option help text + tests. The README
will carry the user-facing how-to.

Signed-off-by: Elron Bandel <elron.bandel@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant