Skip to content

Commit 04f5f4b

Browse files
committed
ENH(plan.TC) why Recompute FAIL must go unsatisfied
1 parent ec46fb7 commit 04f5f4b

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

docs/source/arch.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ Architecture
7070
as described in :ref:`recompute` tutorial section.
7171

7272
.. attention::
73-
This feature has not been thoroughly tested.
73+
This feature is not well implemented (e.g. ``test_recompute_NEEDS_FIX()``),
74+
neither thoroughly tested.
7475

7576
combine pipelines
7677
When `operation`\s and/or `pipeline`\s are `compose`\d together, there are

test/test_graphtik.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,3 +1129,44 @@ def test_recompute_resched_false(quarantine_pipeline, recompute, exp_ops):
11291129
sol = pipe.compute(inp, recompute_from=recompute)
11301130
assert sol == inp
11311131
assert exe_ops(sol) == exp_ops
1132+
1133+
1134+
def test_recompute_NEEDS_FIX():
1135+
pipe = compose(
1136+
...,
1137+
operation(str, "f1", "a", "aa"),
1138+
operation(str, "f2", "b", "bb"),
1139+
operation(lambda a, b: a + b, "ff", ["aa", "bb"], "c"),
1140+
)
1141+
1142+
## Produce sample solution
1143+
#
1144+
sol = pipe.compute({"a": "a", "b": "b"})
1145+
assert sol == {"a": "a", "b": "b", "aa": "a", "bb": "b", "c": "ab"}
1146+
assert exe_ops(sol) == ["f1", "f2", "ff"]
1147+
exp = sol.copy()
1148+
1149+
del exp["b"]
1150+
exp["a"] = "A"
1151+
1152+
## Correct results
1153+
#
1154+
ok_sol = {"a": "A", "aa": "A", "bb": "b", "c": "Ab"}
1155+
ok_ops = ["f1", "ff"]
1156+
sol = pipe.compute(exp, recompute_from="a")
1157+
assert sol == ok_sol
1158+
assert exe_ops(sol) == ok_ops
1159+
1160+
## ...but when recomputing also `b`: boom!
1161+
#
1162+
sol = pipe.compute(exp, recompute_from=["a", "b"])
1163+
assert sol == {"a": "A", "aa": "A", "bb": "b", "c": "ab"}
1164+
assert exe_ops(sol) == ["f1"]
1165+
## FIXME: these are the correct recompute results!!
1166+
# `bb` already in inputs, `ff` should run to calc `c`.
1167+
#
1168+
assert sol != ok_sol
1169+
assert exe_ops(sol) != ok_ops
1170+
pytest.xfail(
1171+
reason="recompute must be incorporated into `unsatisfied_operations()`"
1172+
)

0 commit comments

Comments
 (0)