Skip to main content

v3

dag_wave_ledger record, v3 — canonical aliases.

v3 adds the nullable wave_size_cap column to v2 — see schema.py. Consumers and the record registry import from here and never touch the inner module names, mirroring file_metadata/v1/__init__.py.

Module​

Submodules​

Functions​

downgrade​

def downgrade(op: Operations) ‑> None:

Migrate dag_wave_ledger v3 -> v2 (see the module docstring).

upgrade​

def upgrade(op: Operations) ‑> None:

Migrate dag_wave_ledger v2 -> v3 (see the module docstring).

Classes​

LedgerStatus​

class LedgerStatus(*args, **kwds):

What a ledger row says about its file.

Attributes

  • COMPLETE: Carried through every step of the DAG.
  • PENDING: Planned by a run and not carried by any wave yet.
  • FAILED: Its wave was abandoned; failure_count says how many times.

Variables​

  • static COMPLETE
  • static FAILED
  • static PENDING

ORM​

class ORM(**kwargs):

SQLAlchemy model for the dag_wave_ledger cache table.

One row per file a waved background run has planned for this DAG shape, datasource and project. A complete row is a file carried through every step of the DAG. This is the only place that question is answerable: no step's own partition holds the answer, because the per-file calculation steps write a row for every candidate including the ones they failed, while the eligibility steps are patient-grain and hold no file_id at all.

A pending row is a file the planner would plan and no wave has carried, and a failed row is one whose wave was abandoned; failure_count counts those abandonments. Together they are the lineage's uncarried work, which the scheduler can then see without rebuilding the run's selection.

Written by the wave loop and the planner, never by a step: a step must not write outside its own partition. run_id names the run that last wrote the row, which is how recovery tells whether a run that died had carried anything.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships.

Variables​

  • bitfount_patient_id : sqlalchemy.orm.base.Mapped[str | None]
  • completed_at : sqlalchemy.orm.base.Mapped[str]
  • failure_count : sqlalchemy.orm.base.Mapped[int | None]
  • file_path : sqlalchemy.orm.base.Mapped[str]
  • partition_key : sqlalchemy.orm.base.Mapped[str]
  • project_id : sqlalchemy.orm.base.Mapped[str]
  • run_id : sqlalchemy.orm.base.Mapped[str | None]
  • status : sqlalchemy.orm.base.Mapped[str | None]
  • tags : sqlalchemy.orm.base.Mapped[dict[str, typing.Any] | None]
  • wave_index : sqlalchemy.orm.base.Mapped[int]
  • wave_size_cap : sqlalchemy.orm.base.Mapped[int | None]

Record​

class Record(**data: Any):

One file a waved run planned, carried or failed to carry.

Attributes

  • partition_key: The lineage's scope (store.lineage_partition_key). Set by the store from its own argument.
  • project_id: The lineage's project, or the empty string when it has none. Set by the store from its own argument.
  • file_path: The file, as file_metadata spells it.
  • bitfount_patient_id: The patient the file belongs to, or None for an orphan — a file scan_metadata could not identify.
  • completed_at: When the wave that carried this file finished, or when the row was last written for a row that is not complete.
  • wave_index: Which wave of the sweep carried it; reporting only.
  • run_id: The flow run that wrote it.
  • status: What the row says about the file.
  • failure_count: How many runs abandoned the file's wave since it was last carried.
  • wave_size_cap: The most units a wave holding this file may carry, set when a wave holding it timed out; None for no cap.
  • tags: Free-form provenance, as on every cache record.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables​

  • static bitfount_patient_id : str | None
  • static failure_count : int
  • static file_path : str
  • static model_config
  • static partition_key : str
  • static project_id : str
  • static run_id : str | None
  • static wave_index : int
  • static wave_size_cap : int | None