Skip to content

API Reference parrot.storage.backfill

github-actions[bot] edited this page Dec 2, 2026 · 1 revision

parrot.storage.backfill

View source

Resumable, batched backfill driver for legacy conversation turns (FEAT-886 M11).

Run as python -m parrot.storage.backfill. This module is an operator tool: it is never imported from a request path, because a full scan is exactly what the chronological index exists to avoid at serve time.

Alias BackfillBatch

Re-exported from parrot.storage.backends.base.BackfillBatch.

Class BackfillReport

Outcome of one :func:run_backfill invocation.

Parameter Type Default Description
processed int
complete bool
invalid_sessions Tuple[str, ...]

Fields:

Field Type Default Description
processed int Turns indexed by this invocation (not by earlier resumed segments).
complete bool True when the backend reported next_cursor is None.
invalid_sessions Tuple[str, ...] Sessions left invalid (missing / unparseable timestamp), cumulative for the current pass.

Alias ConversationBackend

Re-exported from parrot.storage.backends.base.ConversationBackend.

Alias build_conversation_backend

Re-exported from parrot.storage.backends.build_conversation_backend.

Attribute logger

Function main

CLI entry point (python -m parrot.storage.backfill). Returns the process exit code.

main(argv: Optional[Sequence[str]] = None) -> int

Parameter Type Default Description
argv Optional[Sequence[str]] None

Returns: int

Function run_backfill

Drive backend.backfill_batch until complete or max_batches is reached.

Resumes from cursor_path when it holds an unfinished pass; a file marked complete starts a new pass (operators re-run after repairing bad timestamps; a pass is cheap and idempotent). The cursor is persisted after every batch.

run_backfill(backend: ConversationBackend, *, batch_size: int = 500, max_batches: Optional[int] = None, cursor_path: Optional[Path] = None) -> BackfillReport

Parameter Type Default Description
backend ConversationBackend An initialised backend.
batch_size int 500 Legacy turns examined per batch (>= 1).
max_batches Optional[int] None Stop after this many batches; None runs to completion.
cursor_path Optional[Path] None State file for resumption; None keeps state in memory only.

Returns: BackfillReport — class:BackfillReport for this invocation.

Raises:

  • ValueError — batch_size or max_batches below 1.
  • RuntimeError — The backend returned the cursor it was given (no progress).
  • StorageError — Propagated from the backend; the last good cursor is already persisted.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally