-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
The following graph with given-1
& given-2
inputs fails to compute with KeyError: 'a'
when the asked
output is asked, but it does so when not asked!
Code to reproduce:
def test_pruning_with_given_intermediate_and_asked_out():
# Test that operations with partial inputs are pruned and not failing.
graph = compose(name="graph")(
operation(name="unjustly pruned", needs=["given-1"], provides=["a"])(lambda a: a),
operat`ion(name="shortcuted", needs=["a", "b"], provides=["given-2"])(add),
operation(name="good_op", needs=["a", "given-2"], provides=["asked"])(add),
)
assert graph({"given-1": 5, "b": 2, "given-2": 2}) == {"given-1": 5, "b": 2, "given-2": 7, "a": 5, "b": 2, "asked": 12} # that ok # FAILS!
assert graph({"given-1": 5, "b": 2, "given-2": 2}, ["asked"]) == {"asked": 12} # FAILS!
Root cause:
- The culling logic in v1.2.4 when specific outputs are asked is to drop indiscriminately all predecessors of the given inputs, which might include values that needs to be computed.
- The existing "pruning" TCs were too simple to catch this..
Metadata
Metadata
Assignees
Labels
No labels