diff options
author | Jürg Billeter <j@bitron.ch> | 2020-09-16 15:55:26 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-12-14 07:35:03 +0100 |
commit | 030214c475738ab35fee6719c97bcdd813ceba50 (patch) | |
tree | a607cd05693b750bb877fb8405ebc09a29957090 | |
parent | 485bd48d624fa0bc802be23cf3a41097b2fd4abf (diff) | |
download | buildstream-030214c475738ab35fee6719c97bcdd813ceba50.tar.gz |
_pipeline.py: Drop the optimization for cached elements in the planner
The overhead of planning already cached elements and unneeded build-only
dependencies should be fairly small as unneeded jobs can still be
skipped. This optimization was also already disabled for non-strict
build plans with a remote artifact cache.
This change is necessary in preparation for parallelizing cache queries.
-rw-r--r-- | src/buildstream/_pipeline.py | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/buildstream/_pipeline.py b/src/buildstream/_pipeline.py index 01ebc2e96..6e41d70c8 100644 --- a/src/buildstream/_pipeline.py +++ b/src/buildstream/_pipeline.py @@ -147,9 +147,8 @@ class Pipeline: # plan() # # Generator function to iterate over only the elements - # which are required to build the pipeline target, omitting - # cached elements. The elements are yielded in a depth sorted - # ordering for optimal build plans + # which are required to build the pipeline target The elements are + # yielded in a depth sorted ordering for optimal build plans # # Args: # elements (list of Element): List of target elements to plan @@ -158,11 +157,7 @@ class Pipeline: # (list of Element): A depth sorted list of the build plan # def plan(self, elements): - # Keep locally cached elements in the plan if remote artifact cache is used - # to allow pulling artifact with strict cache key, if available. - plan_cached = not self._context.get_strict() and self._artifacts.has_fetch_remotes() - - return _Planner().plan(elements, plan_cached) + return _Planner().plan(elements) # get_selection() # @@ -435,9 +430,8 @@ class Pipeline: # _Planner() # # An internal object used for constructing build plan -# from a given resolved toplevel element, while considering what -# parts need to be built depending on build only dependencies -# being cached, and depth sorting for more efficient processing. +# from a given resolved toplevel element, using depth +# sorting for more efficient processing. # class _Planner: def __init__(self): @@ -461,15 +455,13 @@ class _Planner: for dep in element._dependencies(_Scope.RUN, recurse=False): self.plan_element(dep, depth) - # Dont try to plan builds of elements that are cached already - if not element._cached_success(): - for dep in element._dependencies(_Scope.BUILD, recurse=False): - self.plan_element(dep, depth + 1) + for dep in element._dependencies(_Scope.BUILD, recurse=False): + self.plan_element(dep, depth + 1) self.depth_map[element] = depth self.visiting_elements.remove(element) - def plan(self, roots, plan_cached): + def plan(self, roots): for root in roots: self.plan_element(root, 0) @@ -479,4 +471,4 @@ class _Planner: for index, item in enumerate(depth_sorted): item[0]._set_depth(index) - return [item[0] for item in depth_sorted if plan_cached or not item[0]._cached_success()] + return [item[0] for item in depth_sorted] |