Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Operators

The operators, the XCom value every task returns, and the block each task writes to its log.

Operators

Every operator takes the same parameters (plus Airflow’s own: task_id, retries, …). Templated ones accept Jinja; env and env_from_connections are not templated, so their values are never stored as rendered fields. No operator builds argv: one module, invocation.py, builds it and runs the process; reading.py reads rivet’s outputs into units and classifies.

ParameterDefaultTemplatedWhat it is
configrequiredyespath of the rivet YAML config on the worker
exportNoneyesthe export to run; required by RivetApplyOperator and RivetCdcRunOperator; RivetRunOperator without it runs the whole config
tableNoneyesone table of the export, for load and compact
state_dirNoneyesan existing absolute directory on the worker for SQLite state, the config copy, sealed plans, locks and stderr files; never created by a task; required for SQLite state and CDC checkpoints (see State)
plan_fileNoneyesthe layout file RivetPlanOperator rewrites and build_batch_dag reads waves from
rivet_bin"rivet"nothe binary: a name looked up on the worker’s PATH, else the one rivet-cli installed; or an absolute path. A binary that is missing or does not answer its probes is refused before any run (RIVET_AIRFLOW_BINARY_MISSING)
envNonenoextra variables for the rivet process; computed by your DAG file, so no secret literals
env_from_connectionsNoneno{ENV_NAME: conn_id}: a database URL built from an Airflow Connection inside the task (see Connections and secrets); the value may also be {"conn_id": …, "database": …, "odbc_ini": …, "dsn": …}: another database on the same server, and the odbc.ini data source dsn (default the id; MySQL, PostgreSQL, SQL Server and Oracle drivers) when no Connection has the id
env_from_variablesNoneno{ENV_NAME: variable key}: each environment variable takes the value of an Airflow Variable, read when the task runs (a Variable no backend defines is refused: RIVET_AIRFLOW_VARIABLE_MISSING). It is merged like env and is what ${ENV_NAME} in the config resolves to; a name may not be in env too. See Connections and secrets
env_passthrough()noworker variables (names or MY_* patterns) passed on; nothing outside the allow-list is inherited otherwise
cloud_credentials()no"gcp", "aws", "azure": pass the worker’s credential variables of that kind
connections()nostorage and warehouse Connection ids (see “Storage and warehouse connections”)
deployment"auto"nolocal (a host that keeps its disk) or pod (ephemeral); auto reads KUBERNETES_SERVICE_HOST
extra_argsNoneyesarguments appended to rivet’s argv, e.g. ["--reconcile"] on a run task; -p / --param (["-p", "day=2026-10-20"]) only on the run, CDC run and plan tasks, because only rivet run, plan and check take it: the load, compact and apply tasks refuse it before rivet starts (RIVET_AIRFLOW_PARAM_NOT_ACCEPTED), and a ${name} in their config is read from env
lock_wait600noseconds a task waits for another task holding a lock it needs before it ends retryable (RIVET_AIRFLOW_EXPORT_BUSY); the wait is per lock, so a run of the whole config, which takes one lock per export, can wait up to its number of exports times this value; the same wait applies to the lock on the query-file records of a state directory (see State)
rivet_notificationsFalsenoTrue keeps rivet’s own notifications: on: --no-notify is not passed and nothing is warned (see Slack)
crashed_retries1noretries of a crash (a signal, exit 129-255) on their own budget, beside Airflow’s retries (see Retries)
stderr_dirNoneyeswhere rivet’s stdout/stderr files go; default <state_dir>/logs, else the temp directory
stream_stderrFalsenoalso copy rivet’s stderr lines into the task log as they come
log_keep10nostderr/stdout files kept per task; None keeps all
cwdNoneyesthe rivet process’s working directory (default: the original config’s directory); it does not move a relative local destination.path, which lands under state_dir
single_hostFalsenodeclares that every task of this deployment runs on one host; needed for SQLite state under an executor that may use several (Celery, Kubernetes), which is refused otherwise (RIVET_AIRFLOW_STATE_SQLITE_MULTI_HOST, see State)
OperatorRunsNotes
RivetApplyOperatorrivet plan -e X --format json -o <artifact> then rivet apply <artifact>a retry replays the same sealed artifact while it is unexpired, and rivet answers a replay of a plan it already applied (“Retries”); a clear plans again
RivetRunOperatorrivet run [-e X] --summary-output <file>the fallback when sealed apply is not wanted; also runs a whole config
RivetCdcRunOperatorrivet run -e X --summary-output <file> for a mode: cdc exportone bounded drain; succeeds on max_events, reports it, never loops
RivetLoadOperatorrivet load -e X [--table T]per export, per table when table is given
RivetCompactOperatorrivet compact -e X [--table T]rivet’s result says per table whether it merged or skipped (skip_reason); a task whose every unit rivet skipped is an Airflow skip
RivetInitOperatorrivet init then rivet check of what it wrotewrites config once and never replaces it; the task build_source_dags adds while a source has no config (see DAG builders). It takes config, state_dir, rivet_bin and the environment parameters (env, env_from_connections, env_passthrough, cloud_credentials, connections), plus mode, source_env and init_args; the parameters of a rivet run (lock_wait, extra_args, crashed_retries, …) are not its own, and build_source_dags gives them to the run tasks only
RivetPlanOperatorrivet plan --format jsonrewrites the plan layout file atomically, only when the output is a layout build_batch_dag can read (waves with exports; one planned export, which rivet prints as a bare object with no campaign, is one wave from its export_recommendation); the file keeps its mode
from airflow_provider_rivet.operators import RivetApplyOperator

orders = RivetApplyOperator(
    task_id="orders",
    config="/opt/pipelines/postgres.yaml",
    export="orders",
    state_dir="/var/lib/rivet/postgres",
    env_from_connections={"RIVET_PG_URL": "rivet_postgres"},
)

Every task returns (and, on failure, pushes before raising) one XCom value under return_value:

{ "command": "apply", "decision": "success",
  "units": [ { "export": "orders", "table": null, "target": null, "buffer": null,
               "status": "success", "run_id": "orders_...",
               "rows": 2500, "files": 1, "stop_reason": null, "error": null } ],
  "error": null, "degraded": [],
  "exit_status": 0, "signal": null, "stderr_path": "/var/lib/rivet/postgres/logs/...",
  "skip_reason": null, "state_marker": "1d86...", "rivet_version": "0.32.2 (5ee08c0a)" }

A unit has exactly the shape of tests/fixtures/scheduler/xcom_unit*.json; a package test compares the two, so the package and the Rust contract cannot drift. target and buffer are the warehouse objects a load or compact unit wrote and read, as rivet’s result names them (null for a run or apply unit, and null when the binary’s result has no names: the config’s guess is never put in XCom). What the warehouse did (rows inserted, updated and deleted, parts, jobs, bytes) is not part of the XCom unit: it is in the task log and in the rivet.unit record’s digest.

Reading the task log

Each task writes one block when it ends: a headline with the outcome first, one line per rivet step, and indented note lines. A successful apply with SQLite state:

rivet apply users → OK: 30 rows, 1 file in 4.1 s (run users_20261016T092509.120_4242)
  plan     sealed, strategy incremental in 0.8 s
  apply    done in 2.9 s
  note     SQLite state is single-host — see https://github.com/rivet-lab/airflow-provider-rivet/blob/main/docs/state.md#local-worker-setup-guide

A failed one (a retry whose sealed plan another run has overtaken):

rivet apply users → REFUSED [RIVET_PLAN_ARTIFACT_STALE], final
  plan     replayed the sealed plan of an earlier try
  apply    exit 5 in 0.6 s
  export   users: failed [RIVET_PLAN_ARTIFACT_STALE] refusal
  stderr   <state_dir>/logs/<dag_id>/<task_id>-<hash>/<run_id>__try2.apply.stderr.log
  note     SQLite state is single-host — see https://github.com/rivet-lab/airflow-provider-rivet/blob/main/docs/state.md#local-worker-setup-guide

A task of one step that took the task’s time (a load, a compact, a run) has no step line: the headline says it. The step line stays when the step failed or the task spent a second or more outside it (a lock wait). rivet_version is the whole rivet --version line after rivet, so a branch build is told apart from the release.

A load or compact task names the warehouse object it wrote after the arrow, as rivet’s result names it: a load the table of a full export, else its __changes log (rivet load cdc table orders → my-project.demo_cdc.orders__changes: OK: 50 rows in 12.0 s); a compact the buffer it merged and the base (….orders__changes into ….orders). A command whose result names no table (it failed before one) gets the name from the config’s load: block, marked (from config).

With rivet >= 0.32.2 a load or compact also says what the warehouse did, from rivet’s per-table digest (ADR-0039 D3): the headline sums the rows, the warehouse jobs and the bytes billed, and one line per table gives a compact’s inserted / updated / deleted rows and the base’s rows after, a load’s Parquet parts and source runs, the job ids (the first three) and the bytes billed. A value rivet did not return (bytes on ClickHouse and Snowflake, job ids on Snowflake) is left out, never shown as 0:

rivet compact cdc table orders → p.orders__changes into p.orders: OK: 1200 rows, 1 job, 50.0 MiB billed in 3.4 s, after 30.0 s waiting for the lock of export `cdc` (run …)
  table    cdc.orders → p.orders__changes into p.orders: compacted, 1200 rows, 200 inserted, 950 updated, 50 deleted, base 10150 rows, job rivet_compact_orders_1, 50.0 MiB billed (run …)

A task that waited for the export’s lock says so when it takes it (took the lock of export `cdc` after 30.0 s), and its headline gives the time after the wait apart from the wait. A run of a whole config takes one lock per export: its headline sums the waits (after 2.4 s waiting for 2 locks (a, b)), and a BUSY one names the lock that timed out, not the first it waited for. A skipped unit says why in its line and in the headline (SKIPPED: nothing to do (nothing_to_compact)), also for run, apply and cdc_run; two skipped tables with different reasons give them joined with ; .

  • The headline’s outcome is OK, SKIPPED (nothing to do: rivet’s skip_reason, or an earlier try already applied the plan), REFUSED (class refusal, or a preflight refusal before rivet started), FAILED (with its class), CRASHED (a signal or a 129-255 exit), STOPPED (Airflow stopped the task) or BUSY (the export’s lock stayed held, or rivet’s own lease of the export or table was held by another rivet: RIVET_STATE_LOCK_TIMEOUT, RIVET_STATE_RUN_IN_PROGRESS, RIVET_LOAD_TABLE_BUSY; retried). A final failure says final and is an ERROR line; one Airflow retries says retryable, Airflow retries it (try N of M) and is a WARNING line. The registry action follows when rivet printed one, then rivet’s own error text after a colon: FAILED [RIVET_LOAD_WAREHOUSE_REJECTED] generic, final (run 65ed): table 'orders': BigQuery job rivet_orders_0 failed: Not found: Table p:d.orders__changes was not found in location US. A failed table’s or export’s line carries its own text when it differs from the headline’s. The text is the one rivet printed, on one line: Airflow’s secrets masker reads it first, then its lines (cut at \n only) are joined with |, control characters are shown as \u{1b}-style escapes, and it is cut at 300 characters (…). The same text ends the exception message ([code] class: action (export): text); XCom still carries none of it.
  • note lines are INFO, except what you must act on: a notifications: block rivet will send from, a crash-retry ledger that cannot be used (WARNING).
  • No INFO or WARNING line of a successful task holds error or exception, the words Airflow colours red by default ([logging] color_log_error_keywords), unless an export or table name holds one.
  • rivet’s stderr text is never in the block: a failed task prints the file’s path. argv and the structured records are at DEBUG ([logging] logging_level = DEBUG); XCom carries the outcome, units, error object, degradations and paths.