summaryrefslogtreecommitdiff
path: root/buildstream/_pipeline.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-19 14:46:05 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-19 15:11:47 +0900
commit674378036f5389f319a712a58d0bae753af96067 (patch)
tree77cb278d92d30eca0629bfb0b12d2208c822f962 /buildstream/_pipeline.py
parent64069c8c0bced53929db7171674991523accd764 (diff)
downloadbuildstream-674378036f5389f319a712a58d0bae753af96067.tar.gz
_pipeline.py, _frontend/app.py: Added track_selection initialization argument
This informs the pipeline what PipelineSelection mode to use for constructing the list of elements to track.
Diffstat (limited to 'buildstream/_pipeline.py')
-rw-r--r--buildstream/_pipeline.py34
1 files changed, 23 insertions, 11 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py
index 540d0715f..80e7d076c 100644
--- a/buildstream/_pipeline.py
+++ b/buildstream/_pipeline.py
@@ -156,12 +156,14 @@ class Pipeline():
# add_remote_cache (str): The URL for an additional remote artifact cache
# track_element (list of Elements): List of elements specified by the frontend for tracking
# track_cross_junctions (bool): Whether tracking is allowed to cross junction boundaries
+ # track_selection (PipelineSelection): The selection algorithm for track elements
#
def initialize(self,
use_configured_remote_caches=False,
add_remote_cache=None,
track_elements=None,
- track_cross_junctions=False):
+ track_cross_junctions=False,
+ track_selection=PipelineSelection.ALL):
# Preflight directly, before ever interrogating caches or anything.
self._preflight()
@@ -187,7 +189,7 @@ class Pipeline():
self._track_cross_junctions = track_cross_junctions
self._track_elements = []
if track_elements:
- self._track_elements = self._get_elements_to_track(track_elements)
+ self._track_elements = self._get_elements_to_track(track_elements, track_selection)
# Now resolve the cache keys once tracking elements have been resolved
self._resolve_cache_keys()
@@ -620,26 +622,36 @@ class Pipeline():
# _get_elements_to_track():
#
- # Work out which elements are going to be tracked
+ # Work out which elements are going to be tracked.
+ #
+ # Currently the 'mode' parameter only accepts
+ # PipelineSelection.NONE or PipelineSelection.ALL
+ #
+ # This makes the assumption that the except elements are
+ # meant to be removed from tracking element lists.
#
# Args:
- # (list of str): List of target names
+ # track_targets (list of str): List of target names
+ # mode (PipelineSelection): The PipelineSelection mode
#
# Returns:
# (list): List of Element objects to track
#
- def _get_elements_to_track(self, track_targets):
+ def _get_elements_to_track(self, track_targets, mode=PipelineSelection.ALL):
planner = _Planner()
# Convert target names to elements
- target_elements = [e for e in self.dependencies(Scope.ALL)
- if e.name in track_targets]
+ track_elements = [e for e in self.dependencies(Scope.ALL)
+ if e.name in track_targets]
+
+ if mode != PipelineSelection.NONE:
+ assert mode == PipelineSelection.ALL
- # Plan them out
- track_elements = planner.plan(target_elements, ignore_cache=True)
+ # Plan them out
+ track_elements = planner.plan(track_elements, ignore_cache=True)
- # Filter out --except elements
- track_elements = self.remove_elements(track_elements)
+ # Filter out --except elements
+ track_elements = self.remove_elements(track_elements)
# Filter out cross junctioned elements
if self._track_cross_junctions: