From d6ebd6cea97e76e79c2437d4ae93944a983e5727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Mon, 15 Jan 2018 13:31:06 +0100 Subject: Rename _force_inconsistent() to _schedule_tracking() _force_inconsistent is too low level. Keep that detail contained in the Source class. --- buildstream/_frontend/main.py | 14 +++++++------- buildstream/_pipeline.py | 14 +++++++------- buildstream/element.py | 6 +++--- buildstream/source.py | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py index 44c54e95e..e62202013 100644 --- a/buildstream/_frontend/main.py +++ b/buildstream/_frontend/main.py @@ -219,7 +219,7 @@ def build(app, elements, all, track, track_save, track_all, track_except): track = elements app.initialize(elements, except_=track_except, rewritable=track_save, - use_configured_remote_caches=True, inconsistent=track) + use_configured_remote_caches=True, track_elements=track) app.print_heading() try: app.pipeline.build(app.scheduler, all, track, track_save) @@ -262,7 +262,7 @@ def fetch(app, elements, deps, track, except_): """ app.initialize(elements, except_=except_, rewritable=track, - inconsistent=elements if track else None) + track_elements=elements if track else None) try: dependencies = app.pipeline.deps_elements(deps) app.print_heading(deps=dependencies) @@ -300,7 +300,7 @@ def track(app, elements, deps, except_): none: No dependencies, just the element itself all: All dependencies """ - app.initialize(elements, except_=except_, rewritable=True, inconsistent=elements) + app.initialize(elements, except_=except_, rewritable=True, track_elements=elements) try: dependencies = app.pipeline.deps_elements(deps) app.print_heading(deps=dependencies) @@ -580,7 +580,7 @@ def checkout(app, element, directory, force, integrate, hardlinks): def source_bundle(app, target, force, directory, track, compression, except_): """Produce a source bundle to be manually executed""" - app.initialize((target,), rewritable=track, inconsistent=[target] if track else None) + app.initialize((target,), rewritable=track, track_elements=[target] if track else None) try: dependencies = app.pipeline.deps_elements('all') app.print_heading(dependencies) @@ -621,7 +621,7 @@ def workspace(): def workspace_open(app, no_checkout, force, source, track, element, directory): """Open a workspace for manual source modification""" - app.initialize((element,), rewritable=track, inconsistent=[element] if track else None) + app.initialize((element,), rewritable=track, track_elements=[element] if track else None) try: app.pipeline.open_workspace(app.scheduler, directory, source, no_checkout, track, force) click.echo("", err=True) @@ -784,7 +784,7 @@ class App(): # def initialize(self, elements, except_=tuple(), rewritable=False, use_configured_remote_caches=False, add_remote_cache=None, - inconsistent=None): + track_elements=None): profile_start(Topics.LOAD_PIPELINE, "_".join(t.replace(os.sep, '-') for t in elements)) @@ -873,7 +873,7 @@ class App(): try: self.pipeline.initialize(use_configured_remote_caches=use_configured_remote_caches, add_remote_cache=add_remote_cache, - inconsistent=inconsistent) + track_elements=track_elements) except BstError as e: click.echo("Error initializing pipeline: {}".format(e), err=True) sys.exit(-1) diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index 015918dc1..52f1d1807 100644 --- a/buildstream/_pipeline.py +++ b/buildstream/_pipeline.py @@ -144,7 +144,7 @@ class Pipeline(): self.exceptions = resolved_elements[len(targets):] def initialize(self, use_configured_remote_caches=False, - add_remote_cache=None, inconsistent=None): + add_remote_cache=None, track_elements=None): # Preflight directly, before ever interrogating caches or # anything. self.preflight() @@ -163,7 +163,7 @@ class Pipeline(): if len(artifact_caches) > 0: self.initialize_remote_caches(artifact_caches) - self.resolve_cache_keys(inconsistent) + self.resolve_cache_keys(track_elements) def preflight(self): for plugin in self.dependencies(Scope.ALL, include_sources=True): @@ -196,16 +196,16 @@ class Pipeline(): with self.timed_activity("Initializing remote caches", silent_nested=True): self.artifacts.set_remotes(artifact_cache_specs, on_failure=remote_failed) - def resolve_cache_keys(self, inconsistent): - if inconsistent: - inconsistent = self.get_elements_to_track(inconsistent) + def resolve_cache_keys(self, track_elements): + if track_elements: + track_elements = self.get_elements_to_track(track_elements) with self.timed_activity("Resolving cached state", silent_nested=True): for element in self.dependencies(Scope.ALL): - if inconsistent and element in inconsistent: + if track_elements and element in track_elements: # Load the pipeline in an explicitly inconsistent state, use # this for pipelines with tracking queues enabled. - element._force_inconsistent() + element._schedule_tracking() else: # Resolve cache keys and interrogate the artifact cache # for the first time. diff --git a/buildstream/element.py b/buildstream/element.py index 4b084a1b9..54f93091f 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -734,7 +734,7 @@ class Element(Plugin): consistency = min(consistency, source_consistency) return consistency - # _force_inconsistent(): + # _schedule_tracking(): # # Force an element state to be inconsistent. Any sources appear to be # inconsistent. @@ -745,9 +745,9 @@ class Element(Plugin): # and reinterrogation of element state after tracking of elements # succeeds. # - def _force_inconsistent(self): + def _schedule_tracking(self): for source in self.__sources: - source._force_inconsistent() + source._schedule_tracking() # _cached(): # diff --git a/buildstream/source.py b/buildstream/source.py index f83c60ce1..79c1a32b8 100644 --- a/buildstream/source.py +++ b/buildstream/source.py @@ -298,7 +298,7 @@ class Source(Plugin): # keys until the source is RESOLVED and also prevent depending # elements from being assembled until the source is CACHED. # - def _force_inconsistent(self): + def _schedule_tracking(self): self.__consistency = Consistency.INCONSISTENT # Wrapper function around plugin provided fetch method -- cgit v1.2.1