FlowsReference

Large values

A script can return a list of a million rows, and a loop can hand the same 50 MB to every pass. Waiso keeps any value over 1 MiB in storage and moves only a reference — its size, its shape and a short preview — between steps. Your code still receives the value; nothing changes in how you write it. When a value is too big to load at once, read it one item at a time.

What you will learn
  • Know which values are stored and where
  • Read a large input item by item, or as a file
  • Know how long stored values live
  • Recognise the errors and limits

What is stored, and where

A value is stored when its JSON is over 1 MiB: a script’s result, a flow step’s output, a loop’s collected output and the inputs each pass of a loop receives. It goes to the project’s S3 connection (the first one, by creation date), or to the platform’s bucket when the project has none. Each value is written once: a value every pass of a loop reads is stored once, not once per pass.

Inside a flow, a path such as nodes.query.output passes the reference on without loading anything, and .length (or .rows.length) is answered from the reference’s shape. An expression that computes over a stored value — nodes.query.output.filter(…) — loads it, up to 64 MB.

Called through its API endpoint, a run whose result was stored still answers the whole value in output, streamed from storage. Add ?result=link to the call (or to the poll of an async run) to get { size, kind, preview, url } instead: a link to the value, valid for one hour.

RunsEvery script and flow run in this project
Live
Search name or value · amount>100Ctrl KToday7 days30 daysAll time
Kind: AllStatus: AllWaiting for you 1
campaignFlowTriggered byScheduleDuration713msRan at5 h agoStatusSuccess
load_customersstep 1 of campaignTriggered bycampaignDuration38msRan at5 h agoStatusSuccess
send_offer ×4step 2 · loopTriggered bycampaignDuration188msRan at5 h agoStatusSuccess
approvalFlowTriggered byana@shop.devDuration174msRan at5 h agoStatusWaiting
report.pyTriggered byScheduleDuration6.7sRan at4 h agoStatusSuccess
broken.pyTriggered byana@shop.devDuration877msRan at26 min agoStatusFailed
The Runs page: a flow run unfolded into its steps. A step’s output is the same whether it was stored or not.

Read a large input item by item

A parameter main declares receives the whole value, loaded from a file in the job folder — that takes the step’s memory. To read a list without loading it, bind the input in the flow as usual but leave it out of main’s parameters, and read it with waiso.input_items(name) (Python) or inputItems(name) (TypeScript, JavaScript). Each item is read from the file as you go, so a join of 800 MB fits a step of 512 MB.

join_results.py
import waiso

def main():
    # "results" is bound to the loop's output, but it is NOT a parameter of main:
    # nothing is loaded up front, the items are read from a file one at a time.
    blocks = 0
    total = 0
    for r in waiso.input_items("results"):
        blocks += 1
        total += len(r["payload"])
    return {"blocks": blocks, "bytes": total}

The input as a file

waiso.input_path(name) / inputPath(name) gives the input’s file, to read with any parser or library. A list is one JSON value per line (NDJSON); anything else is one JSON document.

read_report.py
import csv, json, waiso

def main():
    # The input's file in the job folder: read it your way (streaming, a parser, pandas…).
    with open(waiso.input_path("report")) as f:
        doc = json.load(f)
    return {"keys": len(doc)}

The other languages read it the same way, an input left out of main’s parameters: Go waiso.InputItems(name, fn) and waiso.InputPath(name), PHP Waiso::inputItems($name) (a generator) and Waiso::inputPath($name), Ruby Waiso.input_items(name) and Waiso.input_path(name), C++ waiso::input_items(name, fn) (each item’s JSON text) and waiso::input_path(name), C waiso_input_path(name), and Bash waiso_input_path name — read the file line by line.

How long a stored value lives

A stored value lives as long as its run. Deleting a run, a flow or a project deletes its stored values from the bucket. Removing the S3 connection the project’s values live in deletes those values with it: without the connection nothing could reach them again, and the runs that produced them then show the value as no longer available.

Everything is kept under p/<project>/ in the bucket (after the connection’s upload prefix), so a lifecycle rule on that bucket can add your own retention on top.

Errors and limits

CodeWhenWhat to do
storage_unavailableA value over 1 MiB had nowhere to go, or the project’s S3 connection failed. With no storage at all, values up to 16 MB still travel inline.Add or fix the project’s S3 connection.
value_too_large_for_expressionAn expression computes over a stored value over 64 MB.Pass the value to a script step and read it with input_items.
out_of_memoryA parameter of main receives a value bigger than the step’s memory.Read it with input_items, or raise the step’s memory.
value_unavailableA stored value could not be read: deleted with its connection, or the storage did not answer.Run the step that produced it again.
stored_ceiling_reachedThe plan’s space on the platform’s bucket is full.Connect your own S3, or free space by deleting old runs.