[engine] Implement the BuildGraph interface via the engine

Review Request #3516 — Created Feb. 29, 2016 and submitted

stuhood
pants
2979, 2987
3514
pants-reviews
benjyw, ity, jsirois, kwlzn, patricklaw, peiyu

This review implements the interface extracted in #3514 using a Scheduler and Engine. With the exception of supporting synthetic target injection (which we hope to remove during the port to the new engine), it should be a "complete" BuildGraph impl.

  • Convert the legacy list impl to dependencies by requesting recursive parsing.
  • Split graph/parser modules out of commands.
  • Subclass BuildGraph with ExpGraph, which is backed by a Scheduler and Engine.
  • Remove goals from BuildRequest and rename to ExecutionRequest... leave def build_request, which translates goals to products
  • Move/remove exp.Target into exp.examples.Target. Struct and its mixins (in particular HasStructs) are the fundamental concepts consumed by the engine.
  • Remove the Scheduler.walk_product_graph method in favor of direct access.
  • Add a def kwargs convenience method to Struct, which strips internal fields.

https://travis-ci.org/pantsbuild/pants/builds/112984994

  • 0
  • 0
  • 2
  • 0
  • 2
Description From Last Updated
ST
KW
  1. nice - lgtm!

  2. 
      
ST
KW
  1. Ship It!
  2. 
      
PA
  1. lgtm with the major caveat that I'm too unfamiliar with the new engine semantics to call out major structural issues if they exist.

  2. We should be outputting to stderr unless the output is meant to be consumed programmatically (i.e. "console task")

    1. This thing is mostly an example, but yes: it is essentially a console task. Will adjust the print in scheduler.py though.

  3. Why ValueError rather than NotImplemented (or make it an @abstractproperty/method)

  4. src/python/pants/engine/exp/struct.py (Diff revision 2)
     
     

    Is key necessary here? By default tuples are sorted element-wise.

  5. 
      
ST
KW
  1. 
      
  2. src/python/pants/engine/exp/legacy/graph.py (Diff revisions 2 - 3)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    you want raise NotImplementedError(...) here as that's the Exception type.

    >>> raise NotImplementedError('blah')
    Traceback (most recent call last):
      File "<input>", line 1, in <module>
    NotImplementedError: blah
    

    NotImplemented a built-in constant for the comparison special methods: https://docs.python.org/2/library/constants.html#NotImplemented

    >>> raise NotImplemented('blah')
    Traceback (most recent call last):
      File "<input>", line 1, in <module>
    TypeError: 'NotImplementedType' object is not callable
    
  3. 
      
PE
  1. 
      
  2. given a scheduler?

  3. engine

  4. 
      
ST
ST
Review request changed

Status: Closed (submitted)

Change Summary:

Merged as a08935def091fc02c33b6bf1734b50d70c362cfe

Loading...