summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-09-16 06:57:36 +0200
committerJürg Billeter <j@bitron.ch>2020-09-16 10:19:54 +0200
commit4aeb4a9f412aa9f6df665e20c0ab1b9fff365d3c (patch)
treef3940fe5cd43b0978dc2639b6d5ce3f2f54e1b9a /src
parente2fb3bd453a4ef5a11b6434780b6ae59303d2cc7 (diff)
downloadbuildstream-4aeb4a9f412aa9f6df665e20c0ab1b9fff365d3c.tar.gz
element.py: Remove __update_ready_for_runtime()
As `bst build --track` and unstable workspace cache keys have been removed, dynamic cache key updates across the element graph are no longer needed.
Diffstat (limited to 'src')
-rw-r--r--src/buildstream/element.py69
1 files changed, 4 insertions, 65 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 445825832..8125d5e7f 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -250,11 +250,8 @@ class Element(Plugin):
self.__reverse_build_deps = set() # type: Set[Element]
# Direct reverse runtime dependency Elements
self.__reverse_runtime_deps = set() # type: Set[Element]
- self.__build_deps_without_cache_key = None # Number of build dependencies without a cache key
- self.__runtime_deps_without_cache_key = None # Number of runtime dependencies without a cache key
self.__build_deps_uncached = None # Build dependencies which are not yet cached
self.__runtime_deps_uncached = None # Runtime dependencies which are not yet cached
- self.__ready_for_runtime = False # Whether the element and its runtime dependencies have cache keys
self.__ready_for_runtime_and_cached = False # Whether all runtime deps are cached, as well as the element
self.__cached_remotely = None # Whether the element is cached remotely
self.__sources = ElementSources(context, project, self) # The element sources
@@ -999,11 +996,9 @@ class Element(Plugin):
element.__strict_dependencies.append(dependency)
no_of_runtime_deps = len(element.__runtime_dependencies)
- element.__runtime_deps_without_cache_key = no_of_runtime_deps
element.__runtime_deps_uncached = no_of_runtime_deps
no_of_build_deps = len(element.__build_dependencies)
- element.__build_deps_without_cache_key = no_of_build_deps
element.__build_deps_uncached = no_of_build_deps
element.__preflight()
@@ -2231,7 +2226,7 @@ class Element(Plugin):
#
def _update_ready_for_runtime_and_cached(self):
if not self.__ready_for_runtime_and_cached:
- if self.__runtime_deps_uncached == 0 and self._cached_success() and self.__cache_key:
+ if self.__runtime_deps_uncached == 0 and self.__cache_key and self._cached_success():
self.__ready_for_runtime_and_cached = True
# Notify reverse dependencies
@@ -3010,14 +3005,9 @@ class Element(Plugin):
dependencies = [[e.project_name, e.name, e.__strict_cache_key] for e in self._dependencies(_Scope.BUILD)]
self.__strict_cache_key = self._calculate_cache_key(dependencies)
- if self.__strict_cache_key is not None:
+ if self.__strict_cache_key is not None and context.get_strict():
# In strict mode, the strong cache key always matches the strict cache key
- if context.get_strict():
- self.__cache_key = self.__strict_cache_key
-
- # The Element may have just become ready for runtime now that the
- # strong cache key has just been set
- self.__update_ready_for_runtime()
+ 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)
@@ -3103,62 +3093,11 @@ class Element(Plugin):
# The Element may have just become ready for runtime now that the
# strong cache key has just been set
- self.__update_ready_for_runtime()
+ self._update_ready_for_runtime_and_cached()
# Now we have the strong cache key, update the Artifact
self.__artifact._cache_key = self.__cache_key
- # __update_ready_for_runtime()
- #
- # An Element becomes ready for runtime when:
- #
- # 1. The Element has a strong cache key
- # 2. The runtime dependencies of the Element are ready for runtime
- #
- # These criteria serve as potential trigger points as to when an Element may have
- # become ready for runtime.
- #
- # Once an Element becomes ready for runtime, we notify the reverse
- # runtime dependencies and the reverse build dependencies of the Element,
- # decrementing the appropriate counters.
- #
- def __update_ready_for_runtime(self):
- if any(
- (
- # We're already ready for runtime; no update required
- self.__ready_for_runtime,
- # If not all our dependencies are ready yet, we can't be ready
- # either.
- not self.__runtime_deps_without_cache_key == 0,
- # If our cache state has not been resolved, we can't be ready.
- self.__cache_key is None,
- )
- ):
- return
-
- self.__ready_for_runtime = True
-
- # Notify reverse dependencies
- for rdep in self.__reverse_runtime_deps:
- rdep.__runtime_deps_without_cache_key -= 1
- assert not rdep.__runtime_deps_without_cache_key < 0
-
- # If all of our runtimes have cache keys, we can calculate ours
- if rdep.__runtime_deps_without_cache_key == 0:
- rdep.__update_ready_for_runtime()
-
- for rdep in self.__reverse_build_deps:
- rdep.__build_deps_without_cache_key -= 1
- assert not rdep.__build_deps_without_cache_key < 0
-
- if rdep.__build_deps_without_cache_key == 0:
- rdep.__update_cache_keys()
-
- # If the element is cached, and has all of its runtime dependencies cached,
- # now that we have the cache key, we are able to notify reverse dependencies
- # that the element it ready. This is a likely trigger for workspaced elements.
- self._update_ready_for_runtime_and_cached()
-
# _OverlapCollector()
#