Repository navigation
Statistics and Costs
stats = dib.summarize(out) # out = the result of run()
print(stats)
# 10000 rows: 9987 ok, 13 failed (99.9% success); 412 reused; tokens 2140311 in / 381220 out;
# 37 retries; latency p50 812 ms, p95 2310 ms; errors: SchemaValidationError x9, RateLimitError x4summarize(output, output_col="output") works on whatever run() returned: a list of
dicts, a pandas DataFrame or a Spark DataFrame. It also works on a table you saved
earlier. It reads only the <out>_error and <out>_meta columns. On Spark it is one
aggregation plus one small group-by, and no rows are collected. For a lazy Spark result
(no checkpoint) it triggers inference, so summarize what you wrote, not the lazy
DataFrame.
| field | meaning |
|---|---|
rows, succeeded, failed
|
row counts; success_rate = succeeded / rows |
reused |
successful rows that were not sent to the model (attempts == 0: dedupe copies) |
retries |
API attempts beyond the first, summed over rows |
prompt_tokens, completion_tokens
|
token usage reported by engines |
audio_seconds |
total transcribed audio |
latency_ms_p50, latency_ms_p95
|
per-row latency percentiles (approximate on Spark) |
errors |
{error class: count} |
to_dict() returns all fields, and str(stats) gives a one-line summary.
Local and multiprocessing runs also log the summary and wall time on the
distribatch logger (logging.getLogger("distribatch"), level INFO).
distribatch ships no price tables, because prices change. Pass yours:
stats.cost(input_per_million=0.50, output_per_million=1.50) # tokens
stats.cost(per_audio_minute=0.006) # transcriptionEmbedding requests with several inputs report usage per request, not per row. For
those runs prompt_tokens undercounts, so use the provider's bill.
with mlflow.start_run(run_name="ticket-routing-2026-10"):
out = job.run(df, backend="spark", checkpoint=..., id_col="ticket_id")
dib.summarize(out).log_to_mlflow(job)This logs every numeric field as distribatch.<field>, error counts as
distribatch.errors.<Class>, and the job's task, model, engine and fingerprint as
params. Needs distribatch[mlflow].
distribatch · Apache-2.0 · repository · issues
Getting started
Jobs
Running
Results
Guides