Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: pruning when output given unjustly drops ancestors #24

Open
ankostis opened this issue Oct 1, 2019 · 0 comments · May be fixed by #26
Open

BUG: pruning when output given unjustly drops ancestors #24

ankostis opened this issue Oct 1, 2019 · 0 comments · May be fixed by #26

Comments

@ankostis
Copy link

ankostis commented Oct 1, 2019

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..
@ankostis ankostis changed the title BUG: culling when output given unjustly drops ancestors BUG: pruning when output given unjustly drops ancestors Oct 2, 2019
ankostis added a commit to ankostis/graphtik that referenced this issue Oct 2, 2019
ankostis added a commit to ankostis/graphtik that referenced this issue Oct 2, 2019
needed to refactor the new pruning algorithm.

- expected 2 TCs fail for yet-to-be-solved yahoo#24 & yahoo#25 bugs.
ankostis added a commit to ankostis/graphtik that referenced this issue Oct 3, 2019
+ Pruning behaves correctly also when outputs given;
  this happens by breaking incoming provide-links
  to any given intermedediate inputs.
+ Unsatisfied detection now includes those without outputs
  due to broken links (above).
+ Remove some uneeded "glue" from unsatisfied-detection code,
  leftover from previous compile() refactoring.
+ Renamed satisfiable --> satisfied.
+ Improved unknown output requested raise-message.
+ x2 TCs, in yahoo#24 and 1st in yahoo#25 now PASS.
- 2x TCs in yahoo#25 still FAIL, and need "Pinning" of given-inputs
  (the operation MUST and MUST NOT run in these cases).
ankostis added a commit to ankostis/graphtik that referenced this issue Oct 3, 2019
+ Pruning behaves correctly also when outputs given;
  this happens by breaking incoming provide-links
  to any given intermedediate inputs.
+ Unsatisfied detection now includes those without outputs
  due to broken links (above).
+ Remove some uneeded "glue" from unsatisfied-detection code,
  leftover from previous compile() refactoring.
+ Renamed satisfiable --> satisfied.
+ Improved unknown output requested raise-message.
+ x2 TCs, in yahoo#24 and 1st in yahoo#25 now PASS.
- 2x TCs in yahoo#25 still FAIL, and need "Pinning" of given-inputs
  (the operation MUST and MUST NOT run in these cases).
ankostis added a commit to ankostis/graphtik that referenced this issue Oct 3, 2019
+ Pruning behaves correctly also when outputs given;
  this happens by breaking incoming provide-links
  to any given intermedediate inputs.
+ Unsatisfied detection now includes those without outputs
  due to broken links (above).
+ Remove some uneeded "glue" from unsatisfied-detection code,
  leftover from previous compile() refactoring.
+ Renamed satisfiable --> satisfied.
+ Improved unknown output requested raise-message.
+ x2 TCs, in yahoo#24 and 1st in yahoo#25 now PASS.
- 2x TCs in yahoo#25 still FAIL, and need "Pinning" of given-inputs
  (the operation MUST and MUST NOT run in these cases).
ankostis added a commit to ankostis/graphtik that referenced this issue Oct 3, 2019
+ Pruning behaves correctly also when outputs given;
  this happens by breaking incoming provide-links
  to any given intermedediate inputs.
+ Unsatisfied detection now includes those without outputs
  due to broken links (above).
+ Remove some uneeded "glue" from unsatisfied-detection code,
  leftover from previous compile() refactoring.
+ Renamed satisfiable --> satisfied.
+ Improved unknown output requested raise-message.
+ x2 TCs, in yahoo#24 and 1st in yahoo#25 now PASS.
- 2x TCs in yahoo#25 still FAIL, and need "Pinning" of given-inputs
  (the operation MUST and MUST NOT run in these cases).
ankostis added a commit to ankostis/graphtik that referenced this issue Oct 3, 2019
+ Pruning behaves correctly also when outputs given;
  this happens by breaking incoming provide-links
  to any given intermedediate inputs.
+ Unsatisfied detection now includes those without outputs
  due to broken links (above).
+ Remove some uneeded "glue" from unsatisfied-detection code,
  leftover from previous compile() refactoring.
+ Renamed satisfiable --> satisfied.
+ Improved unknown output requested raise-message.
+ x3 TCs PASS, x1 in yahoo#24 and the first x2 in yahoo#25.
- 1x TCs in yahoo#25 still FAIL, and need "Pinning" of given-inputs
  (the operation MUST and MUST NOT run in these cases).
ankostis added a commit to ankostis/graphtik that referenced this issue Oct 3, 2019
+ Pruning behaves correctly also when outputs given;
  this happens by breaking incoming provide-links
  to any given intermedediate inputs.
+ Unsatisfied detection now includes those without outputs
  due to broken links (above).
+ Remove some uneeded "glue" from unsatisfied-detection code,
  leftover from previous compile() refactoring.
+ Renamed satisfiable --> satisfied.
+ Improved unknown output requested raise-message.
+ x3 TCs PASS, x1 in yahoo#24 and the first x2 in yahoo#25.
- 1x TCs in yahoo#25 still FAIL, and need "Pinning" of given-inputs
  (the operation MUST and MUST NOT run in these cases).
ankostis added a commit to ankostis/graphtik that referenced this issue Oct 3, 2019
+ Pruning behaves correctly also when outputs given;
  this happens by breaking incoming provide-links
  to any given intermedediate inputs.
+ Unsatisfied detection now includes those without outputs
  due to broken links (above).
+ Remove some uneeded "glue" from unsatisfied-detection code,
  leftover from previous compile() refactoring.
+ Renamed satisfiable --> satisfied.
+ Improved unknown output requested raise-message.
+ x3 TCs PASS, x1 in yahoo#24 and the first x2 in yahoo#25.
- 1x TCs in yahoo#25 still FAIL, and need "Pinning" of given-inputs
  (the operation MUST and MUST NOT run in these cases).
ankostis referenced this issue in syamajala/graphkit Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant