Docs/Learn

Architecture

A Rust pipeline that keeps total input size out of the in-memory work queue.

Download .md
Developers6 min read10 sections
SYSTEM OVERVIEW DatasetJob

From an input list to a dataset you can inspect and resume.

  1. 01InputURL file
  2. 02FetchPolicy & pacing
  3. 03ExtractScoped rows
  4. 04CommitShards & state
Single-node jobs · Exact deduplication · JSONL / CSV
Source reference · Match your SDK version. Availability and known issues
In this guide

The dataset pipeline

SDKs pass configuration into Rust. Fetching runs asynchronously; parsing and extraction run on blocking workers. The job coordinator writes output and state incrementally, returning a small final report.

URL file
  → bounded fetch concurrency
  → body limit and HTML parsing
  → records scoped to row containers
  → normalization and validation
  → disk-backed exact deduplication
  → flushed data/error shards
  → atomic checkpoint advancement
text8 lines · copy-ready

Memory and storage

Input is read in bounded checkpoint batches. Total memory includes concurrent responses, DOM trees, extracted page records, pending identity keys, transport pools, runtime threads and the database cache. No single configuration value caps total RSS.

Disk usage grows with input and accepted records. Exact identity values are retained so hash collisions cannot silently discard distinct records.

Local ownership and recovery

Each job directory has one Sled writer. Output is flushed before state advances. Recovery replays the unfinished batch. The design is single-node; distributed leases and remote shard commits are not implemented.

Where each part lives

ComponentResponsibilityBoundary
SDK wrappers and CLIAccept configuration and invoke the Rust job.The wrappers expose language-specific APIs; their interfaces are not identical.
DatasetJobRead a URL file, coordinate batches, write shards and return a report.Each job owns a local output directory and has one writer.
Session and fetch managerShare request settings, HTTP transports, rate limiting and retry policy.A session is process-local; several workers need external rate coordination.
Parser and extractionParse fetched HTML, find row containers and extract fields.This is not a browser-complete HTML or CSS engine.
Sled and shard filesStore checkpoint and exact identity data; write JSONL or CSV output.The design does not implement distributed ownership or object-store commits.

Follow one job through the system

Fetching is asynchronous. Parsing runs on blocking workers, and the job consumes results in input order. A slow early page can hold later results until its turn. The full input file is not assembled as one in-memory work queue.

Errors for individual pages and rows are written into error shards. A fatal configuration, state or storage error can stop the job rather than producing a complete report.

URL file + job configuration
  → validate settings and open job state
  → read up to checkpoint_pages URL lines
  → validate URLs and check URL identity
  → robots policy and session fetch
  → parse HTML and extract row-scoped fields
  → validate values and check record identity
  → write data and error shards
  → record file hashes and advance checkpoint
  → publish report and manifest
text10 lines · copy-ready

Requests, pacing and response limits

A job prepares each request from the Session: headers, cookies, proxy, timeout, retry count and fetcher settings. If enabled, robots rules are checked before the page request. The fetch manager applies transport and middleware behavior, including per-host pacing and retry decisions.

Concurrency controls in-flight page work. Session rate limiting controls per-host request pacing for that session. They solve different problems: a concurrency of two does not itself mean two requests per second. Multiple processes do not share the same in-memory limiter.

The default HTTP transport enforces its own streaming body cap. DatasetJob then checks max_response_bytes on the fetched body before parsing; a smaller job limit is not a separate streaming cap. These limits do not cap the memory used by the entire process.

From HTML to validated rows

A row_selector identifies repeated containers. Each configured field is selected inside its own container, so a missing field in one row does not move a value from the next row. Without row_selector, the job extracts a single record from the page.

required, default, data_type and min_length affect validation. Job values are represented as strings even when validated as integers, floats or booleans. Rejected rows are recorded separately; a successful HTTP response alone is not evidence of correct extraction.

DatasetJob uses explicit selectors. The separate Dataset builder can use heuristic auto-match; that does not make bulk-job extraction self-healing. Inspect representative rows after a site changes.

Exact identity and bounded batches

URL deduplication checks canonicalized input URLs. Record deduplication compares the selected dedup_fields, or all extracted fields when the list is empty. Source metadata is added after record identity is chosen.

The job stores canonical identity values alongside hash-based keys; collision slots keep distinct values separate. checkpoint_bytes limits pending record identity data in a batch. Other allocations, including URL keys and parsed pages, still contribute to memory use.

Deduplication is local to a job directory. It does not detect semantically similar records, merge later updates or coordinate identities across separate jobs.

What happens at a checkpoint

On resume the job checks the input/configuration signature and verifies the committed shard hashes. A changed input, job configuration, engine version or checkpoint format requires a new directory. Keep the same session settings too; they are not fully included in the signature.

Cancellation replays the uncommitted batch on a new job instance. A completed job does not refresh source pages or retry already committed failures. Disk-full and power-loss behavior require separate testing on the target filesystem.

StepActionAfter interruption
1. StageWrite a data shard and an error shard to temporary paths.A partially processed batch is not a committed checkpoint.
2. Publish filesFlush files, move them into place and calculate integrity metadata.Files beyond the committed checkpoint are treated as uncommitted on resume.
3. Advance stateApply URL keys, record identities, file metadata and input offset in a Sled batch.The checkpoint is the progress boundary for committed shards.
4. ReportWrite report and manifest snapshots after processing.After a hard interruption they may lag; reopen the job before consuming output.

Choose an integration point

GoalUseKeep in mind
Scheduled datasetUse a URL-file DatasetJob from the CLI or SDK.Persist the full output directory between retries.
Inspect a few pagesUse Page or the collecting Dataset builder.These APIs retain results and are not the million-record export path.
JavaScript navigationUse Playwright or another browser for discovery or a defined rendering pipeline.Browser-rendered HTML is not automatically fed into DatasetJob.
Analysis and storageRead committed JSONL or CSV with a downstream tool.Preserve source identifiers and record transformations.
Other formatsUse the separate Rust streaming or collected export APIs.DatasetJob itself writes JSONL and CSV, not checkpointed Parquet.