Skip to content

Refresh Large_Scale_Tasks_Recipe.py for the current Task Group API - #75

Open
elijahgjacob wants to merge 2 commits into
parallel-web:mainfrom
elijahgjacob:elijah/refresh-large-scale-tasks-recipe
Open

elijahgjacob wants to merge 2 commits into
parallel-web:mainfrom
elijahgjacob:elijah/refresh-large-scale-tasks-recipe

Conversation

@elijahgjacob

@elijahgjacob elijahgjacob commented Sep 23, 2026 •

Copy link
Copy Markdown

Summary

The Large-Scale Tasks recipe was written a year ago against client.beta.task_group with a hard-coded product-matching spec, and it no longer reflects how we run big batches. This replaces it with a generic, resumable runner on the current SDK surface. Same filename so existing links keep working.

What the new recipe does

  • plan: counts runs, requests, and groups and estimates enqueue time from your quota. No API calls.
  • submit: adds runs 1,000 per request with refresh_status=False, paced at 90% of --rate-limit (runs per minute), sharded into Task Groups. Every add_runs response is appended to runs.jsonl before the next request, so a crash or re-run never resubmits a paid run. Any CSV works: all columns become string input fields, or one column can be sent as JSON.
  • status: polls each group summary, optionally until no group is active. Its output is how you see the running count plateau, which is what a throughput pilot should measure.
  • export: streams each group's runs to JSONL with output and per-field basis, then checks every input row came back exactly once. Exits 2 if anything is missing, duplicated, or unexpected.

The module docstring covers what people get wrong on large jobs: the rate limit governs intake not throughput, runs cannot be cancelled once created, and a pilot should be at least 5k runs measured after concurrency plateaus. Wording matches the "Sizing a Large Job" section proposed in shapleyai/documentation#748.

Also updates the recipe descriptions in the root and python-recipes READMEs.

Tested against the live API

2,000 lite runs, 2026-09-22, group tgrp_4dd7cbbb4a3541ce883cecaac94c1e7d, about $10:

Command Result
plan --input rows.csv 2 requests, 1 group, 1.1 min enqueue at the 2,000/min default
submit Two 1,000-run requests, paced, 67 s wall clock
submit again "2000 already submitted, 0 to go", no API writes
status --wait Polled every 60 s; all 2,000 completed in about 8 min, 0 failed
export 2,000 rows with output and basis; validation ok: true, exit 0

The running count climbed 267 → 400 → 495 → 652 over the first four minutes before draining, the same ramp-up seen in the docs pilot. That is why the docstring says to pilot at least 5k runs and measure after the plateau rather than end to end.

Failure path, earlier 3-run check: a fake row appended to runs.jsonl made export report missing: 1, ok: false, exit 2.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BqEaXBEuFVsj4Cz5iHyy2q

elijahgjacob and others added 2 commits September 22, 2026 17:00
The old recipe was a product-matching script on the beta SDK surface with a
hard-coded task spec. This replaces it with a generic, resumable batch runner
on client.task_group: plan (no API calls), paced submit at 1,000 runs per
request under the caller's quota with run ids checkpointed before the next
request, status across groups, and JSONL export that validates every input
row came back exactly once (exit 2 otherwise).

Verified end to end against the live API on 3 lite runs: submit, resume
no-op, status, export with basis, and a tampered run log failing validation.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqEaXBEuFVsj4Cz5iHyy2q
@elijahgjacob
elijahgjacob marked this pull request as ready for review September 23, 2026 01:03
@elijahgjacob
elijahgjacob requested a review from a team September 23, 2026 01:03

This branch has not been deployed

No deployments
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