You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:49:34 UTC

[buildstream] 01/02: Remove element._cached_failure()

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch traveltissues/cached
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit d5f2ed9b375758d057b7d5f395b1e43067e0478a
Author: Darius Makovsky <tr...@protonmail.com>
AuthorDate: Thu Jan 16 10:32:00 2020 +0000

    Remove element._cached_failure()
---
 src/buildstream/_frontend/cli.py                |  2 +-
 src/buildstream/_frontend/widget.py             |  2 +-
 src/buildstream/_scheduler/queues/buildqueue.py |  2 +-
 src/buildstream/element.py                      | 17 +----------------
 4 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index fc501f0..e1499ce 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -731,7 +731,7 @@ def shell(app, element, sysroot, mount, isolate, build_, cli_buildtree, pull_, c
                         use_buildtree = choice
 
         # Raise warning if the element is cached in a failed state
-        if use_buildtree and element._cached_failure():
+        if use_buildtree and not element._cached_success():
             click.echo("WARNING: using a buildtree from a failed build.", err=True)
 
         try:
diff --git a/src/buildstream/_frontend/widget.py b/src/buildstream/_frontend/widget.py
index 98ebf31..36e9c83 100644
--- a/src/buildstream/_frontend/widget.py
+++ b/src/buildstream/_frontend/widget.py
@@ -352,7 +352,7 @@ class LogLine(Widget):
             else:
                 if element.get_kind() == "junction":
                     line = p.fmt_subst(line, "state", "junction", fg="magenta")
-                elif element._cached_failure():
+                elif not element._cached_success():
                     line = p.fmt_subst(line, "state", "failed", fg="red")
                 elif element._cached_success():
                     line = p.fmt_subst(line, "state", "cached", fg="magenta")
diff --git a/src/buildstream/_scheduler/queues/buildqueue.py b/src/buildstream/_scheduler/queues/buildqueue.py
index d98b494..3c41171 100644
--- a/src/buildstream/_scheduler/queues/buildqueue.py
+++ b/src/buildstream/_scheduler/queues/buildqueue.py
@@ -41,7 +41,7 @@ class BuildQueue(Queue):
         to_queue = []
 
         for element in elts:
-            if not element._cached_failure() or element in self._tried:
+            if element._cached_success() or element in self._tried:
                 to_queue.append(element)
                 continue
 
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 595724f..b099411 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -1146,22 +1146,7 @@ class Element(Plugin):
         success, _, _ = self._get_build_result()
         if success:
             self.__cached_successfully = True
-            return True
-        else:
-            return False
-
-    # _cached_failure():
-    #
-    # Returns:
-    #    (bool): Whether this element is already present in
-    #            the artifact cache and the element did not assemble successfully
-    #
-    def _cached_failure(self):
-        if not self._cached():
-            return False
-
-        success, _, _ = self._get_build_result()
-        return not success
+        return bool(success)
 
     # _buildable():
     #