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 2022/07/20 07:24:30 UTC
[buildstream] 01/02: element.py: In non-strict mode, retry failed builds whenever dependencies change
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch tristan/retry-failed-build-non-strict
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit ad66549587eea81bf0d8a5a2cc95148771c15d92
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Wed Jul 20 12:18:13 2022 +0900
element.py: In non-strict mode, retry failed builds whenever dependencies change
Fixes #1460
---
src/buildstream/element.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 57e5b7564..4fa74e2c3 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -1831,6 +1831,10 @@ class Element(Plugin):
#
# Load artifact from cache or pull it from remote artifact repository.
#
+ # Args:
+ # pull (bool): Whether to attempt to pull the artifact
+ # strict (bool|None): Force strict/non-strict operation
+ #
# Returns: True if the artifact has been downloaded, False otherwise
#
def _load_artifact(self, *, pull, strict=None):
@@ -1874,6 +1878,21 @@ class Element(Plugin):
# Attempt to pull artifact with the weak cache key
pulled = pull and artifact.pull(pull_buildtrees=pull_buildtrees)
+ # In non-strict mode we ignore a failed artifact unless it has the expected strong key
+ #
+ # This ensures that failed builds will be retried whenever dependencies have changed.
+ if artifact.cached() and artifact.strong_key != self.__cache_key:
+ success, _, _ = artifact.load_build_result()
+ if not success:
+ artifact = Artifact(
+ self,
+ context,
+ strict_key=self.__strict_cache_key,
+ weak_key=self.__weak_cache_key,
+ )
+ artifact._cached = False
+ pulled = False
+
self.__artifact = artifact
return pulled