Skip to main content
Version: latest

agrag.ingestion.match_blocks.write_keep_apart_blocks

write_keep_apart_blocks(txn:GraphStoreTransaction, pairs:Sequence[tuple[UUID, UUID]], *, source:BlockSource, pending_job_id:str | None, reason:str | None = None) -> None

Upsert keep apart blocks for each pair in an open transaction.

A user block replaces a model block, while a model block leaves an existing user block unchanged. Blocks written by a job carry its id so commit publishes them and rollback removes them.

Parameters:

  • txn (GraphStoreTransaction) – The transaction to write in.
  • pairs (Sequence[tuple[UUID, UUID]]) – Entity id pairs to keep apart.
  • source (BlockSource) – Whether the block comes from a user or the model.
  • pending_job_id (str | None) – The in-flight job's id, or None outside a job.
  • reason (str | None) – Optional explanation to store with the block.