[engine] When requesting select nodes or regular nodes, return state values rather than requiring a separate call

Review Request #4261 — Created Sept. 26, 2016 and submitted

nhoward_tw
pants
3904
pants-reviews
jsirois, kwlzn, stuhood, yujiec

Currently, when ever a selector is being resolved, the node calls StepContext#select_node and then StepContext#get with the result without doing much with the node value. The same is also somewhat true of gen_nodes.

This replaces usages of select_node and get with select_for, which returns just the state.
It also replaces gen_nodes and get with get_nodes_and_states_for.

The other structural change is that DependenciesNode now iterates over the subject-variant tuples instead of the nodes generated.

The motivation here is to move away from exposing nodes for selectors to the node implementations.

Ran engine tests locally. CI away on the PR.

ST
  1. Nice... like the focus on Selectors rather than Nodes.

  2. src/python/pants/engine/nodes.py (Diff revision 1)
     
     

    I think that in this case, because the subject and variants are lost, the errors could become more inscrutible. But the change still seems like an improvement, so not a strong objection.

    1. I think it should be ok since this should show up under Computing xxxx for yyyy. But I do have concerns around error messaging.

  3. src/python/pants/engine/nodes.py (Diff revision 1)
     
     

    xx

  4. 
      
NH
NH
NH
KW
  1. lgtm!

  2. src/python/pants/engine/nodes.py (Diff revision 1)
     
     
     

    finish the comment and then convert to a docstring?

  3. 
      
YU
  1. Ship It!
  2. src/python/pants/engine/nodes.py (Diff revision 3)
     
     

    nit: self -> cls

  3. 
      
NH
NH
NH
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted as https://github.com/pantsbuild/pants/commit/da4d0d106d1849a2d745cf89977cd587b107ae68
Loading...