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:34:12 UTC

[buildstream] branch jennis/die_update_state created (now b3371fd)

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

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


      at b3371fd  element.py: Separate initial resolving of elements from _update_state

This branch includes the following new commits:

     new 2c98259  element.py: cache key should be set in __update_cache_keys
     new b3371fd  element.py: Separate initial resolving of elements from _update_state

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] 01/02: element.py: cache key should be set in __update_cache_keys

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2c9825918e0d56663779b6da727bfb3527a33538
Author: James Ennis <ja...@codethink.co.uk>
AuthorDate: Mon Jun 10 11:44:57 2019 +0100

    element.py: cache key should be set in __update_cache_keys
---
 src/buildstream/element.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index a605460..a448b86 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -3006,6 +3006,8 @@ class Element(Plugin):
     # has changed.
     #
     def __update_cache_keys(self):
+        context = self._get_context()
+
         if self.__weak_cache_key is None:
             # Calculate weak cache key
             # Weak cache key includes names of direct build dependencies
@@ -3033,6 +3035,10 @@ class Element(Plugin):
             ]
             self.__strict_cache_key = self._calculate_cache_key(dependencies)
 
+        # In strict mode, the strong cache key always matches the strict cache key
+        if self.__strict_cache_key is not None and context.get_strict():
+            self.__cache_key = self.__strict_cache_key
+
         if self.__strict_cache_key is not None and self.__can_query_cache_callback is not None:
             self.__can_query_cache_callback(self)
             self.__can_query_cache_callback = None
@@ -3068,7 +3074,6 @@ class Element(Plugin):
 
             # In strict mode, the strong cache key always matches the strict cache key
             if context.get_strict():
-                self.__cache_key = self.__strict_cache_key
                 self.__artifact = self.__strict_artifact
 
     # __update_cache_key_non_strict()


[buildstream] 02/02: element.py: Separate initial resolving of elements from _update_state

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b3371fd8ce271424fe5f95669f62e3a47f06f91a
Author: James Ennis <ja...@codethink.co.uk>
AuthorDate: Mon Jun 10 16:46:28 2019 +0100

    element.py: Separate initial resolving of elements from _update_state
    
    A new _resolve_cache_keys_and_state() method has been added to
    Element. This ensures that sources are consistent, calculates
    the cache keys and then determines the artifact state.
---
 src/buildstream/_pipeline.py |  7 +++++--
 src/buildstream/element.py   | 26 ++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/src/buildstream/_pipeline.py b/src/buildstream/_pipeline.py
index d448133..427836a 100644
--- a/src/buildstream/_pipeline.py
+++ b/src/buildstream/_pipeline.py
@@ -135,8 +135,11 @@ class Pipeline():
                 # Preflight
                 element._preflight()
 
-                # Determine initial element state.
-                element._update_state()
+                element._resolve_cache_keys_and_state()
+
+                # EWWW
+                if element._get_workspace() and not element._cached_success():
+                    element._set_required()
 
     # dependencies()
     #
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index a448b86..fdbddc1 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -1170,6 +1170,32 @@ class Element(Plugin):
         # cache cannot be queried until strict cache key is available
         return self.__strict_cache_key is not None
 
+    def _resolve_cache_keys_and_state(self):
+        context = self._get_context()
+
+        # Ensure the element's sources are resolved
+        self.__update_source_state()
+        if self._get_consistency() == Consistency.INCONSISTENT:
+            return
+
+        # Update the cache keys
+        # Note that for non-strict mode, the strong cache key cannot be
+        # calculated until we have updated the artifact state
+        self.__update_cache_keys()
+
+        # update the artifact state
+        self.__update_artifact_state()
+
+        if not context.get_strict():
+            self.__update_cache_key_non_strict()
+
+        # If the element is workspaced, it could potentially already be cached,
+        # therefore, determine the artifact data of the workspaced element
+        # immediately and check if it's cached.
+        # If not, reset the data
+        if self._get_workspace() and not self._cached_success():
+            self.__reset_cache_data()
+
     # _update_state()
     #
     # Keep track of element state. Calculate cache keys if possible and