From 0b2cbd1916c276345d1f71f27bba209672195236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Tue, 23 Jan 2018 12:28:07 +0000 Subject: Keep track of failed pull operations Do not consider pull as pending if pull failed. This is required to allow fallback to fetch and build after pull failure. --- buildstream/_scheduler/pullqueue.py | 3 +++ buildstream/element.py | 13 +++++++++++++ 2 files changed, 16 insertions(+) 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 -- cgit v1.2.1