From 4e3eac1d610a403314d4bb5e21c55f9fe986f14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Mon, 21 Sep 2020 15:56:46 +0200 Subject: _stream.py: Add query_cache() method This is preparation for explicit cache query. --- src/buildstream/_frontend/cli.py | 2 ++ src/buildstream/_stream.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py index 5e42bda68..3428b3d27 100644 --- a/src/buildstream/_frontend/cli.py +++ b/src/buildstream/_frontend/cli.py @@ -551,6 +551,8 @@ def show(app, elements, deps, except_, order, format_): dependencies = app.stream.load_selection(elements, selection=deps, except_targets=except_) + app.stream.query_cache(dependencies) + if order == "alpha": dependencies = sorted(dependencies) diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index 0aff5fb94..dc76edad9 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -163,6 +163,18 @@ class Stream: return target_objects + # query_cache() + # + # Query the artifact and source caches to determine the cache status + # of the specified elements. + # + # Args: + # elements (list of Element): The elements to check + # + def query_cache(self, elements): + # Cache is implicitly queried on demand + pass + # shell() # # Run a shell @@ -614,6 +626,8 @@ class Stream: targets, selection=selection, use_artifact_config=True, load_artifacts=True ) + self.query_cache(target_objects) + if self._artifacts.has_fetch_remotes(): self._pipeline.check_remotes(target_objects) @@ -633,6 +647,8 @@ class Stream: # Return list of Element and/or ArtifactElement objects target_objects = self.load_selection(targets, selection=_PipelineSelection.NONE, load_artifacts=True) + self.query_cache(target_objects) + artifact_logs = {} for obj in target_objects: ref = obj.get_artifact_name() @@ -661,6 +677,8 @@ class Stream: # Return list of Element and/or ArtifactElement objects target_objects = self.load_selection(targets, selection=_PipelineSelection.NONE, load_artifacts=True) + self.query_cache(target_objects) + elements_to_files = {} for obj in target_objects: ref = obj.get_artifact_name() -- cgit v1.2.1