Limit how much dmog writes

Stop a translation or a program with --max-output-bytes once its output would pass a size you choose.

An input you don't control could make a very large output, and a job should stop before it fills a disk. --max-output-bytes sets a ceiling, in bytes, on what dmog writes.

Set the limit #

Give the limit with translate or run:

$ dmog translate --from csv --to jsonl --max-output-bytes 100 books.csv; echo $?
{"code":"RESOURCE_LIMIT_EXCEEDED","message":"the output would exceed 100 bytes: 97 written, 8 more","limit":{"name":"max_output_bytes","value":100},"output":"none"}
5

dmog stopped with RESOURCE_LIMIT_EXCEEDED and exit status 5. The failure's limit names the limit and its value.

What to watch for #

The message counts what had been written when the limit was met. "output":"none" says none of it reached standard output: dmog holds a record until it is complete, and drops what it holds when a run fails. A long run can have written earlier records already, and then the failure says "output":"partial".

A run under its limit writes everything, as it would without one. For how dmog holds a record back, see Why dmog streams.

This page describes dmog 0.4.0. Edit this page · This page as Markdown