summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-01-23 12:28:07 +0000
committerJürg Billeter <j@bitron.ch>2018-01-23 12:28:07 +0000
commit0b2cbd1916c276345d1f71f27bba209672195236 (patch)
treef8bfc1c414843393a03470ad4edc8d5de0fa2bb5
parentd98312b263dee3481691719eb5acfe3b86692af9 (diff)
downloadbuildstream-juerg/202.tar.gz
Keep track of failed pull operationsjuerg/202
Do not consider pull as pending if pull failed. This is required to allow fallback to fetch and build after pull failure.
-rw-r--r--buildstream/_scheduler/pullqueue.py3
-rw-r--r--buildstream/element.py13
2 files changed, 16 insertions, 0 deletions
diff --git a/buildstream/_scheduler/pullqueue.py b/buildstream/_scheduler/pullqueue.py
index e879b4689..4cc0f8a1b 100644
--- a/buildstream/_scheduler/pullqueue.py
+++ b/buildstream/_scheduler/pullqueue.py
@@ -56,6 +56,9 @@ class PullQueue(Queue):
if returncode != 0:
return False
+ if not result:
+ element._pull_failed()
+
element._update_state()
# Element._pull() returns True if it downloaded an artifact,
diff --git a/buildstream/element.py b/buildstream/element.py
index 11e27ad89..d74007b6b 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -143,6 +143,7 @@ class Element(Plugin):
self.__strong_cached = None # Whether we have a cached artifact
self.__remotely_cached = None # Whether we have a remotely cached artifact
self.__remotely_strong_cached = None # Whether we have a remotely cached artifact
+ self.__pull_failed = False # Whether pull was attempted but failed
self.__log_path = None # Path to dedicated log file or None
self.__splits = None
@@ -1370,6 +1371,11 @@ class Element(Plugin):
# (bool): Whether a pull operation is pending
#
def _pull_pending(self):
+ if self.__pull_failed:
+ # Consider this equivalent to artifact being unavailable in
+ # remote cache
+ return False
+
if not self.__strong_cached and self.__remotely_strong_cached:
# Pull pending using strict cache key
return True
@@ -1380,6 +1386,13 @@ class Element(Plugin):
# No pull pending
return False
+ # _pull_failed()
+ #
+ # Indicate that pull was attempted but failed.
+ #
+ def _pull_failed(self):
+ self.__pull_failed = True
+
# _update_state()
#
# Keep track of element state. Calculate cache keys if possible and