﻿# Dagster single-run backfills require range-aware asset code

Dagster BackfillPolicy.single_run groups partitions into one execution; asset code must process the selected range instead of assuming one partition_key per run.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-dagster-single-run-backfill-range/
Language: en

## Distinguish orchestration grouping from data coverage

A document-processing asset can rebuild historical partitions with separate executions or submit a range to an external batch engine. Dagster's [backfill guide](https://dagster.io/docs/guides/build/partitions-and-backfills/backfilling-data) supports a single run covering selected partitions. Grouping reduces orchestration overhead in suitable systems, but it does not automatically rewrite asset code that previously handled one partition at a time. The requested historical coverage remains the same obligation.

## Select the policy through the supported interface

The [partitions reference](https://dagster.io/docs/api/dagster/partitions) defines `BackfillPolicy.single_run()` and the multi-run policy's grouping control. The guide also requires compatible policy use when selecting assets in an asset job. Do not infer current controls from an old interface screenshot: the guide explicitly notes that its former single-versus-multiple-run toggle was removed. Treat the policy in code and the actual selected assets as the execution contract.

## Read the range from execution context

The [execution reference](https://dagster.io/docs/api/dagster/execution) provides a partition-key list, key range and time window. Choose the representation appropriate for the storage query. Code using only `partition_key` must be adapted for the grouped execution. A time-window property also has requirements on the partition definition; a static category collection should not be treated as though it inherently supplies a contiguous interval of timestamps.

## Write the same coverage that was read

If a batch query reads a selected interval, its output operation must replace or create the corresponding intended slices. Avoid writing every result to a path derived from an obsolete single-key assumption. Define boundaries consistently, including how storage handles the end of a time window. [Task contracts](/journal/learn-codex-task-contract/) should identify the complete rebuilt partition set, rather than accepting a successful external query as proof that every historical output was updated.

## Inspect partial failures at the data boundary

A grouped execution can fail after an external engine has written some output. Record the selected range and actual storage outcome so a subsequent attempt can reconcile it. [Tool observations](/journal/learn-codex-tool-observation/) preserve those facts. Backfill grouping changes the unit Dagster schedules; it does not make every remote write atomic. A useful completion review compares intended partition coverage with readable outputs and leaves incomplete slices visible instead of relying solely on the number of orchestration runs that finished.
