summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2018-06-04 18:06:40 +0100
committerRichard Maw <richard.maw@codethink.co.uk>2018-07-27 17:29:55 +0100
commit3c58ac98ea63b532e79952cf9c0357dd184c8953 (patch)
tree0c5c4489a6a8c1b27eee2eebf08127cd284a2a67
parent6c1776d557efe0d84ac9e04ad099b8aecdb41a70 (diff)
downloadbuildstream-3c58ac98ea63b532e79952cf9c0357dd184c8953.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 dab8cab56..5967b0d2c 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 d4a70e6ed..efb646cdf 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1013,7 +1013,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:
@@ -1119,7 +1119,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
@@ -1145,7 +1145,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
@@ -1487,7 +1487,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: