Skip to content

0.42.0

Latest

Choose a tag to compare

@github-actions github-actions released this 01 Dec 04:13

Added

  • A batch channel (type: batch, build::batch()) for loading many backdated inputs at once. It appends inputs to numbered files in the run's batches/<channel>/ directory and runs its command once per file, every size inputs (10,000 by default) and once more when the run finishes, including after Ctrl-C. The command gets the file's path in RNGO_BATCH_FILE and its contents on stdin. A file is deleted once its command succeeds; a command that exits non-zero fails the run, and its file is kept. A partial batch is also sent before the run sends an input to another channel and before a --realtime wait, so an input on another channel (such as an API call) finds the rows it depends on already loaded.
  • Channel::flush, which the proxy calls on the last channel used before sending to a different one and before a realtime wait. It does nothing by default; a custom channel that holds inputs back delivers them there.
  • ProxyBuilder::dir gives channels a directory to write files in, read with ChannelBuildContext::dir. ChannelBuildContext::realtime tells a channel whether the proxy is realtime. ChannelError::batch reports a failed batch.
  • A csv format (type: csv, build::csv_format()) that writes an input's data object as one CSV row with no header, for bulk loaders such as Postgres COPY: one field per key in key order, null as an empty field, strings always quoted, arrays and objects as quoted JSON. Data that isn't an object is reported as an error output and left out.
  • split: effect on a batch channel (BatchBuilder::split_by_effect) writes one file per effect and column list, and runs the command once per file, parents first, with RNGO_BATCH_EFFECT, RNGO_BATCH_TABLE (the effect's metadata.table, else its key) and RNGO_BATCH_COLUMNS set. A failed file stops the run and is kept with the files after it; files already loaded stay loaded. BatchBuilder::effect_table and load_after set tables and load order in Rust, and ChannelError::with_batch_target names a failed file's effect and table.
  • Each run of a batch channel's command writes a batch metadata row to the log (documented in LOG.md): its channel, batch number, effect and table (with split: effect), first and last input id, size, start and end times, and exit status, so a signal can check that every batch loaded. A failed command writes its row before the run stops. OutputSender::metadata lets a custom channel write metadata rows too.
  • With split: effect, a batch command also gets RNGO_BATCH_TABLE_QUOTED and RNGO_BATCH_COLUMNS_QUOTED: the table and columns with each name in double quotes and any " in it doubled ("Posts", "id","createdAt"), so mixed-case names load in Postgres, SQLite and DuckDB without quoting them in the command. Quoted names are case-sensitive, so with them an effect's metadata.table and data keys must match the database's names exactly.

Changed

  • When a channel fails mid-run, rngo eval still finishes the other channels and commits the log before reporting the error.
  • Breaking (Rust API): Channel::finish returns Result<(), ChannelError> and Proxy::finish returns Result<(), ProxyError>, so a channel can report a failure while finishing. Proxy::finish finishes every channel before returning the first error. To migrate, a custom channel that overrides finish returns Ok(()). Callers of Proxy::finish that use ? into Box<dyn Error> need no change; code that matched on its LogError matches ProxyError::Log instead.

Fixed

  • On Windows, rngo eval no longer needs administrator rights or Developer Mode: when it can't create the .rngo/evals/last symlink, it creates a directory junction instead.
  • If .rngo/evals/last can't be updated, rngo eval prints a warning and runs anyway instead of failing.