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:33 UTC

[buildstream] branch traveltissues/cached created (now 943364a)

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

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


      at 943364a  wip

This branch includes the following new commits:

     new d5f2ed9  Remove element._cached_failure()
     new 943364a  wip

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 02/02: wip

Posted by tv...@apache.org.
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 943364abaa7a306e77e1679b96ad8b052e21c8c2
Author: Darius Makovsky <tr...@protonmail.com>
AuthorDate: Thu Jan 16 12:09:03 2020 +0000

    wip
---
 src/buildstream/element.py | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index b099411..088a8b8 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -261,7 +261,8 @@ class Element(Plugin):
         self.__assemble_scheduled = False  # Element is scheduled to be assembled
         self.__assemble_done = False  # Element is assembled
         self.__pull_done = False  # Whether pull was attempted
-        self.__cached_successfully = None  # If the Element is known to be successfully cached
+        self.__cached_successfully = None  # If the Element is known to be cached in a build-sucessful state
+        self.__cached_failure = None  # If the Element is known to be cached in a build-failure state
         self.__source_cached = None  # If the sources are known to be successfully cached
         self.__splits = None  # Resolved regex objects for computing split domains
         self.__whitelist_regex = None  # Resolved regex object to check if file is allowed to overlap
@@ -1132,21 +1133,19 @@ class Element(Plugin):
     #    (bool): Whether this element is already present in
     #            the artifact cache and the element assembled successfully
     #
-    def _cached_success(self):
+    def _cached_result(self):
         # FIXME:  _cache() and _cached_success() should be converted to
         # push based functions where we only update __cached_successfully
         # once we know this has changed. This will allow us to cheaply check
         # __cached_successfully instead of calling _cached_success()
-        if self.__cached_successfully:
+        if self.__cached_successfully or self.__cached_failure:
             return True
-
         if not self._cached():
             return False
-
         success, _, _ = self._get_build_result()
-        if success:
-            self.__cached_successfully = True
-        return bool(success)
+        self.__cached_successfully = bool(success)
+        self.__cached_failure = not bool(success)
+        return True
 
     # _buildable():
     #


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

Posted by tv...@apache.org.
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():
     #