summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2018-06-04 18:06:40 +0100
committerknownexus <phillip.smyth@codethink.co.uk>2018-07-31 17:31:36 +0100
commitf4573df3de42255f330020804bc62512eb5339d4 (patch)
tree50ce490bd2005b5f9a70c8fe747ac34b5f8f95e5
parentb3a68e2883e4217c807603181db14d8f1d813f17 (diff)
downloadbuildstream-f4573df3de42255f330020804bc62512eb5339d4.tar.gz
Convert call-sites of Element._cached() that assume success
When we later add cached failures it needs to not treat them as successes.
-rw-r--r--buildstream/_frontend/widget.py2
-rw-r--r--buildstream/_pipeline.py4
-rw-r--r--buildstream/_scheduler/queues/buildqueue.py2
-rw-r--r--buildstream/element.py8
4 files changed, 8 insertions, 8 deletions
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index 1bae73ca0..78f444616 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -368,7 +368,7 @@ class LogLine(Widget):
if consistency == Consistency.INCONSISTENT:
line = p.fmt_subst(line, 'state', "no reference", fg='red')
else:
- if element._cached():
+ if element._cached_success():
line = p.fmt_subst(line, 'state', "cached", fg='magenta')
elif consistency == Consistency.RESOLVED:
line = p.fmt_subst(line, 'state', "fetch needed", fg='red')
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py
index 852abf7ff..800a331fd 100644
--- a/buildstream/_pipeline.py
+++ b/buildstream/_pipeline.py
@@ -489,7 +489,7 @@ class _Planner():
self.plan_element(dep, depth)
# Dont try to plan builds of elements that are cached already
- if not element._cached():
+ if not element._cached_success():
for dep in element.dependencies(Scope.BUILD, recurse=False):
self.plan_element(dep, depth + 1)
@@ -501,4 +501,4 @@ class _Planner():
self.plan_element(root, 0)
depth_sorted = sorted(self.depth_map.items(), key=itemgetter(1), reverse=True)
- return [item[0] for item in depth_sorted if plan_cached or not item[0]._cached()]
+ return [item[0] for item in depth_sorted if plan_cached or not item[0]._cached_success()]
diff --git a/buildstream/_scheduler/queues/buildqueue.py b/buildstream/_scheduler/queues/buildqueue.py
index 376ef5ae2..691b9ff80 100644
--- a/buildstream/_scheduler/queues/buildqueue.py
+++ b/buildstream/_scheduler/queues/buildqueue.py
@@ -43,7 +43,7 @@ class BuildQueue(Queue):
# Keep it in the queue.
return QueueStatus.WAIT
- if element._cached():
+ if element._cached_success():
return QueueStatus.SKIP
if not element._buildable():
diff --git a/buildstream/element.py b/buildstream/element.py
index 16b09f85a..fff212588 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1014,7 +1014,7 @@ class Element(Plugin):
# if the pull job is still pending as the remote cache may have an artifact
# that matches the strict cache key, which is preferred over a locally
# cached artifact with a weak cache key match.
- if not dependency._cached() or not dependency._get_cache_key(strength=_KeyStrength.STRONG):
+ if not dependency._cached_success() or not dependency._get_cache_key(strength=_KeyStrength.STRONG):
return False
if not self.__assemble_scheduled:
@@ -1120,7 +1120,7 @@ class Element(Plugin):
# are sufficient. However, don't update the `cached` attributes
# until the full cache query below.
if (not self.__assemble_scheduled and not self.__assemble_done and
- not self.__is_cached(keystrength=_KeyStrength.WEAK) and
+ not self.__cached_success(keystrength=_KeyStrength.WEAK) and
not self._pull_pending() and self._is_required()):
self._schedule_assemble()
return
@@ -1146,7 +1146,7 @@ class Element(Plugin):
self.__weak_cached = self.__artifacts.contains(self, self.__weak_cache_key)
if (not self.__assemble_scheduled and not self.__assemble_done and
- not self.__cached and not self._pull_pending() and self._is_required()):
+ not self._cached_success() and not self._pull_pending() and self._is_required()):
# Workspaced sources are considered unstable if a build is pending
# as the build will modify the contents of the workspace.
# Determine as early as possible if a build is pending to discard
@@ -1488,7 +1488,7 @@ class Element(Plugin):
def _assemble(self):
# Assert call ordering
- assert not self._cached()
+ assert not self._cached_success()
context = self._get_context()
with self._output_file() as output_file: