import numpy as np
from dascore.lazy.chain import Chain, Node
from dascore.proc.basic import Abs
pending = Node(Abs(), {})
assert pending.pending
node = pending.settled((3, 2), np.float64, "an-id")
chain = Chain().append(node)
assert len(chain) == 1 and chain.last is node
assert node.made() == ((3, 2), np.dtype("float64"), "an-id")chain
The operations pending on a lazy array, as a linear chain.
A Node is one step: the processor, the plan its get_metadata worked out, the chunk contract it was chained under, and what the step made – the shape and dtype of its output and the data_id of the patch which holds it. A node is pending from the moment a kernel appends it until the operation settles it with those three facts, before the resulting patch is built. A Chain is the steps in the order they run. Both are immutable: appending makes a new chain.
Examples
Classes
| Name | Description |
|---|---|
| Chain | The steps pending on a lazy array, in the order they run. |
| Node | One pending operation, and what it made once settled. |