You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 08:13:34 UTC

[buildstream] 01/01: Add TODOs for each _update_state() call

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch jennis/minor_optimisations
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 6176333d6dad453adfd276f0b9850e390b606b48
Author: James Ennis <ja...@codethink.co.uk>
AuthorDate: Wed Apr 10 15:38:31 2019 +0100

    Add TODOs for each _update_state() call
---
 buildstream/_loader/loader.py |  1 +
 buildstream/_pipeline.py      |  3 +++
 buildstream/element.py        | 23 +++++++++++++++++++++--
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/buildstream/_loader/loader.py b/buildstream/_loader/loader.py
index 6d8310c..882e886 100644
--- a/buildstream/_loader/loader.py
+++ b/buildstream/_loader/loader.py
@@ -552,6 +552,7 @@ class Loader():
             basedir = sources[0]._get_local_path()
         else:
             # Stage sources
+            # TODO: New object to update cache keys here
             element._update_state()
             basedir = os.path.join(self.project.directory, ".bst", "staged-junctions",
                                    filename, element._get_cache_key())
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py
index c176b82..14e8c80 100644
--- a/buildstream/_pipeline.py
+++ b/buildstream/_pipeline.py
@@ -136,6 +136,9 @@ class Pipeline():
                 element._preflight()
 
                 # Determine initial element state.
+                # TODO: Everything...
+                # Get the consistency of sources
+                # Update cache keys, if workspaced, schedule for assembly
                 element._update_state()
 
     # dependencies()
diff --git a/buildstream/element.py b/buildstream/element.py
index 5c28b47..561d952 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1384,6 +1384,8 @@ class Element(Plugin):
         self.__tracking_scheduled = False
         self.__tracking_done = True
 
+        # TODO: Update the cache keys of all reverse deps
+        # Also maybe_assemble each of these
         self.__update_state_recursively()
 
     # _track():
@@ -1540,13 +1542,15 @@ class Element(Plugin):
         if self.__required:
             # Already done
             return
-
         self.__required = True
 
         # Request artifacts of runtime dependencies
         for dep in self.dependencies(Scope.RUN, recurse=False):
             dep._set_required()
 
+            # TODO: Notice that we'll be calling update on the deps before we do this to the top level first
+            # We now need to know whether we need to schedule assembly for the deps
+            # So we MIGHT need to do this, call some maybe_assemble function
         self._update_state()
 
     # _is_required():
@@ -1561,6 +1565,7 @@ class Element(Plugin):
     # This is called in the main process before the element is assembled
     # in a subprocess.
     #
+    # TODO: This will be called by CacheKey.maybe_assemble()
     def _schedule_assemble(self):
         assert not self.__assemble_scheduled
         self.__assemble_scheduled = True
@@ -1576,6 +1581,10 @@ class Element(Plugin):
         if workspace:
             workspace.invalidate_key()
 
+        # TODO: Hopefully get rid of entirely?
+        # - Case 1, This is the first time that an uncached, non-strict, can't pull, element can determine it's strong cache key
+        # - Case 2, for workspaces, just set ~everything to None (look at update state now)
+        # NOTE: We probably don't need to do anything that update state does for a strict element
         self._update_state()
 
     # _assemble_done():
@@ -1591,6 +1600,9 @@ class Element(Plugin):
         self.__assemble_scheduled = False
         self.__assemble_done = True
 
+        # TODO:
+        # For workspaces get all the cache keys of reverse deps
+        #  - They might also now know whether they should be assembled
         self.__update_state_recursively()
 
         if self._get_workspace() and self._cached_success():
@@ -1783,7 +1795,10 @@ class Element(Plugin):
     def _fetch_done(self):
         # We are not updating the state recursively here since fetching can
         # never end up in updating them.
-        self._update_state()
+
+        # TODO: Fetching does not change cachekeys or whether to schedule something
+        # Just ensure that the sources are consistent.
+        self.__update_source_state()
 
     # _pull_pending()
     #
@@ -1827,6 +1842,10 @@ class Element(Plugin):
     def _pull_done(self):
         self.__pull_done = True
 
+
+        # TODO:
+        # In strict mode, we don't need to do anything.
+        # For nonstrict - calc strong cache keys for itself and reverse deps
         self.__update_state_recursively()
 
     # _pull():