diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2019-10-23 11:39:40 +0100 |
---|---|---|
committer | Tristan Maat <tristan.maat@codethink.co.uk> | 2019-11-04 11:26:48 +0000 |
commit | 7c41d439064a5bd5eb1cadf9ebf99e1a8aeccef0 (patch) | |
tree | d720bd967d591ec8507be8645d307ef9d3275265 | |
parent | 4ab2b6687d1dbda6da2f636290bcc2957ef9d39e (diff) | |
download | buildstream-7c41d439064a5bd5eb1cadf9ebf99e1a8aeccef0.tar.gz |
element.py: Make ex-_update_state() components private
-rw-r--r-- | src/buildstream/element.py | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py index b777ea2df..3aab4c0f8 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -1258,7 +1258,7 @@ class Element(Plugin): # - _update_artifact_state() # - Computes the state of the element's artifact using the # cache key. - # - __schedule_assemble() + # - __maybe_schedule_assemble() # - Schedules assembly of an element, iff its current state # allows/necessitates it # - __update_cache_key_non_strict() @@ -1284,10 +1284,11 @@ class Element(Plugin): ), "_initialize_state() should only be called once" self._resolved_initial_state = True - # FIXME: It's possible that we could call a less broad method - # here if we could get the source cache key without updating - # the full source state. - self._update_source_state() + # This will update source state, and for un-initialized + # elements recursively initialize anything else (because it + # will become considered outdated after source state is + # updated). + self.__update_source_state() # _get_display_key(): # @@ -1354,7 +1355,7 @@ class Element(Plugin): # Tracking may change the source's ref, and therefore the # source state. We need to update source state. - self._update_source_state() + self.__update_source_state() # _track(): # @@ -1517,10 +1518,10 @@ class Element(Plugin): dep._set_required() # When an element becomes required, it must be assembled for - # the current pipeline. `__schedule_assemble()` will abort if + # the current pipeline. `__maybe_schedule_assemble()` will abort if # some other state prevents it from being built, and changes # to such states will cause re-scheduling, so this is safe. - self._schedule_assemble() + self.__maybe_schedule_assemble() # Callback to the Queue if self.__required_callback is not None: @@ -1581,12 +1582,12 @@ class Element(Plugin): not self._cached() ) - # _schedule_assemble(): + # __maybe_schedule_assemble(): # # This is called in the main process before the element is assembled # in a subprocess. # - def _schedule_assemble(self): + def __maybe_schedule_assemble(self): if not self.__should_schedule(): self.__update_cache_key_non_strict() return @@ -1794,7 +1795,7 @@ class Element(Plugin): # Fetching cannot change the source state from INCONSISTENT to CACHED because # we prevent fetching when it's INCONSISTENT. # Therefore, only the source state will change. - self._update_source_state() + self.__update_source_state() # _pull_pending() # @@ -1847,7 +1848,7 @@ class Element(Plugin): # We may not have actually pulled an artifact - the pull may # have failed. We might therefore need to schedule assembly. - self._schedule_assemble() + self.__maybe_schedule_assemble() self._update_ready_for_runtime_and_cached() # _pull(): @@ -2401,7 +2402,7 @@ class Element(Plugin): # Private Local Methods # ############################################################# - # _update_source_state() + # __update_source_state() # # Updates source consistency state # @@ -2409,7 +2410,7 @@ class Element(Plugin): # cache keys, because the source's ref, whether defined in yaml or # from the workspace, is a component of the element's cache keys. # - def _update_source_state(self): + def __update_source_state(self): # Cannot resolve source state until tracked if self.__tracking_scheduled: @@ -3175,7 +3176,7 @@ class Element(Plugin): # to this element. # # If the state changes, this will subsequently call - # `self.__schedule_assemble()` to schedule assembly if it becomes + # `self.__maybe_schedule_assemble()` to schedule assembly if it becomes # possible. # # Element.__update_cache_keys() must be called before this to have @@ -3191,7 +3192,7 @@ class Element(Plugin): if not context.get_strict() and not self.__artifact: # We've calculated the weak_key, so instantiate artifact instance member self.__artifact = Artifact(self, context, weak_key=self.__weak_cache_key) - self._schedule_assemble() + self.__maybe_schedule_assemble() if not self.__strict_cache_key: return @@ -3202,7 +3203,7 @@ class Element(Plugin): if context.get_strict(): self.__artifact = self.__strict_artifact - self._schedule_assemble() + self.__maybe_schedule_assemble() else: self.__update_cache_key_non_strict() |