summaryrefslogtreecommitdiff
path: root/src/buildstream/element.py
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.co.uk>2019-05-28 17:31:07 +0100
committerJames Ennis <james.ennis@codethink.co.uk>2019-06-07 14:47:16 +0100
commit2908ca8f2b417f7b0824a934770619d0f8cf8909 (patch)
treeb11b6021fd5dca76b525918c7cf8c1c1d3f8da51 /src/buildstream/element.py
parent14514683bad92f9947540784572173036310ce29 (diff)
downloadbuildstream-2908ca8f2b417f7b0824a934770619d0f8cf8909.tar.gz
queue.py: Use heapq for the ready queuejennis/push_based_pipeline
This patch includes setting a _depth to each element once the pipeline has been sorted. This is necessary as we need to store elements in the heapq sorted by their depth.
Diffstat (limited to 'src/buildstream/element.py')
-rw-r--r--src/buildstream/element.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 355773f76..84c8f20ff 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -244,6 +244,8 @@ class Element(Plugin):
self.__can_query_cache_callback = None # Callback to PullQueue/FetchQueue
self.__buildable_callback = None # Callback to BuildQueue
+ self._depth = None # Depth of Element in its current dependency graph
+
# Ensure we have loaded this class's defaults
self.__init_defaults(project, plugin_conf, meta.kind, meta.is_junction)
@@ -2310,6 +2312,16 @@ class Element(Plugin):
def _set_buildable_callback(self, callback):
self.__buildable_callback = callback
+ # _set_depth()
+ #
+ # Set the depth of the Element.
+ #
+ # The depth represents the position of the Element within the current
+ # session's dependency graph. A depth of zero represents the bottommost element.
+ #
+ def _set_depth(self, depth):
+ self._depth = depth
+
#############################################################
# Private Local Methods #
#############################################################