Block Execution
Flow pins decide when a block runs: one block at a time, depth first, never in parallel on their own. Data blocks are computed when something needs them, and a block that fails usually reports it on its pins while the flow continues.
Flow pins say when, data pins say what
Data moves between blocks through pin connections. Connect an out-pin of one block to an in-pin of another and you have a data pathway. There are two kinds of connection:
- Flow pins control when a block executes. A block with a flow in-pin runs only when it receives the flow signal from a preceding block.
- Data pins carry typed data (value, number, condition, object, array, date, file, query, mutations and so on). They define what a block receives or produces.
Blocks without a flow in-pin, such as value_default, condition_is_true or query_bool_filter, are evaluated when the block they connect to needs their data. They are resolved on demand, as part of the execution chain.
Flow paths run one after another, depth first
Execution follows the flow pin connections, one block at a time. When a flow starts, for example from a trigger_custom_function block, RUAL runs the block its flow out-pin is wired to, then follows that block's own flow out-pins, and so on.
When a block has several flow out-pins, or one flow out-pin is wired to several blocks, RUAL follows them one after another. It runs the first target and everything downstream of it to the end before it starts the second target: depth first, never in parallel.
- Routing blocks such as
branch,elseifandswitchchoose which of their outputs run. Every other block runs all of its wired flow outputs. - A block that cancels the flow stops what follows it.
- Different flow outputs of one block run in the order of their pin ids.
- Several wires on the same output run in the order they are saved in. In Blueprint Language that is the order you read: an
onblock runs before the statements that follow it.
parallel_functions, function_run_parallel, or the concurrency pin of function_foreach and array_map. Separate requests and events do run at the same time, each in its own run, so read-modify-write sections that must not overlap still need lock or wait blocks. Each node keeps a prepared copy of the blueprint
A node prepares a blueprint once and keeps that copy in memory: this is the precompiled blueprint. It holds the blueprint's structure, not values. Every run computes its own values, and within one run a data block is computed at most once however many blocks read it. A save refreshes the precompiled blueprint on every node, and there is no idle expiry.
When calling functions, only pass the data you actually need, for example just a guid instead of an entire object.
A failed block usually does not stop the flow
Most blocks that can fail report it on their own output pins and let the flow continue:
success: a condition pin,trueif the operation succeeded andfalseif it failed.error: a value pin holding the error message when the operation fails.
There is one exception. When a flow block itself cannot execute at all, its error pin is set to RUAL_SYSTEM_ERROR and the run ends there, so nothing after that block runs.
Checking these pins is your job. Common patterns:
- Check the
successpin and show an error message on the page, for instance withweb_errorsin a web action. - Log errors to storage or send them to an external webhook (for example, an email notification).
- Use a condition block to branch the flow on whether the operation succeeded.
{
"success": false,
"error": "Document not found for the given GUID"
}success and error pins on blocks that perform storage operations, HTTP requests, or other operations that can fail. Simulate, read the console, check the audit log
Simulation traces a flow without executing it
Blocks at the beginning of a flow have a play icon. Click it to set custom input values and run the flow in simulation mode. The simulation traces through the connected blocks and shows the output at each step.
Production mode runs for real
Selecting Production in the play mode options executes the flow as if it were live, on real stores and with real side effects. Use it deliberately. The permission can be disabled for specific users in User Access Management.
The console shows execution details
Open it with the console button in the bottom bar, or with View Console in the blueprint menu. It helps identify issues in your flows.
The audit log records every modification
Every blueprint change is logged automatically. Timeline in the blueprint menu shows the whole blueprint. A block's options () has Revisions, for the changes affecting only that block.
Three ways to run work in the background
| Pattern | Use case |
|---|---|
| Queue | Offload computationally intensive tasks (like PDF generation) to background processing. The queue executes a function at a specified time, potentially on another node. Use the function_custom_execute_from_queue block. |
| Storage Events | React to document changes (create, update, remove) in a specific storage. These events execute asynchronously after the document operation completes, on a FIFO basis. Use the storage_event block. |
| Repeating Events | Schedule recurring tasks at a specified interval, similar to setInterval() or crontab. Use the schedule_repeating_event block. |
function_custom_execute block executes a function and waits for it to complete before continuing the flow. To run something in the background without waiting, use the queue instead. Locks keep overlapping runs apart
When multiple flows could modify the same data at the same time, locking blocks prevent race conditions:
function_claim_lock_wait: sets a lock, or waits until an existing lock has been released.function_claim_lock_v2: tries to claim a lock and returns whether it succeeded.function_claim_unlock: releases an existing lock.
The storage system itself is transaction-based (updates are processed sequentially per document). Locking is for when a broader set of operations must not overlap. See Locking and Concurrency.
Rules of thumb for a run
- Keep flows focused. Each flow should have a single responsibility. Use functions to break complex logic into smaller, reusable pieces.
- Use namespaces. When managing many functions across blueprints, use the namespace feature to organize them.
- Check error pins. Always handle the
successanderrorpins on blocks that touch storage, external APIs, or anything else that can fail. - Offload heavy work. Use the queue for tasks like PDF generation, email sending or batch processing that need not complete immediately.
- Use caching. Redis cache avoids repeated storage queries. See Common Pitfalls for proper cache usage.
Next steps
Object References and Copies Objects are passed by reference: which blocks change the original. Common Blueprint Patterns Recipes that put these rules to work: error handling, caching and API replies.Frequently asked
In what order do blocks execute in a RUAL blueprint?
Execution follows the flow pin connections one block at a time. When a block has several flow outputs, or one flow output is wired to several blocks, they run one after another, and each path runs to its end before the next one starts, never in parallel. Different flow outputs run in the order of their pin ids, and several wires on one output in the order they are saved in. To run work concurrently, use parallel_functions, function_run_parallel or the concurrency pin of function_foreach or array_map.
When are data-only blocks evaluated in RUAL?
Blocks without a flow in-pin, such as value_default, condition_is_true or query_bool_filter, are evaluated on demand when the block they connect to needs their data, resolved as part of the execution chain.
Does RUAL have a try/catch mechanism?
No. Each block handles its own errors and exposes the result through a success condition pin and an error value pin, and the flow usually does not stop on failure. Only a flow block that cannot execute at all ends the run, with RUAL_SYSTEM_ERROR on its error pin. It is the developer's responsibility to check those pins on every block that can fail.
What is precompiled data in RUAL?
Each node prepares a blueprint's structure once and keeps it in memory. Block values are not kept: every run computes its own, and within one run a data block is computed at most once. A save refreshes the prepared blueprint on every node, so the first request on each node after a save is the expensive one. There is no idle expiry.