summaryrefslogtreecommitdiff
path: root/buildstream/_scheduler
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-05-10 11:23:01 +0200
committerJürg Billeter <j@bitron.ch>2018-05-11 08:01:12 +0200
commit270da0609978ce6d269865b6bd451ec560a983ef (patch)
tree875688fd3084009a949beda9056f114875830003 /buildstream/_scheduler
parentb78df1e2c546236d7c6166f293d7838df887f70f (diff)
downloadbuildstream-270da0609978ce6d269865b6bd451ec560a983ef.tar.gz
Do not pull/fetch/build elements that are not required
For `bst build --deps plan`, do not process elements in pull/fetch/build queues until they are requested by a reverse dependency.
Diffstat (limited to 'buildstream/_scheduler')
-rw-r--r--buildstream/_scheduler/buildqueue.py5
-rw-r--r--buildstream/_scheduler/fetchqueue.py5
-rw-r--r--buildstream/_scheduler/pullqueue.py5
3 files changed, 15 insertions, 0 deletions
diff --git a/buildstream/_scheduler/buildqueue.py b/buildstream/_scheduler/buildqueue.py
index 46ce72ca7..24a124b32 100644
--- a/buildstream/_scheduler/buildqueue.py
+++ b/buildstream/_scheduler/buildqueue.py
@@ -38,6 +38,11 @@ class BuildQueue(Queue):
# state of dependencies may have changed, recalculate element state
element._update_state()
+ if not element._is_required():
+ # Artifact is not currently required but it may be requested later.
+ # Keep it in the queue.
+ return QueueStatus.WAIT
+
if element._cached():
return QueueStatus.SKIP
diff --git a/buildstream/_scheduler/fetchqueue.py b/buildstream/_scheduler/fetchqueue.py
index c2bceb270..61055725d 100644
--- a/buildstream/_scheduler/fetchqueue.py
+++ b/buildstream/_scheduler/fetchqueue.py
@@ -47,6 +47,11 @@ class FetchQueue(Queue):
# state of dependencies may have changed, recalculate element state
element._update_state()
+ if not element._is_required():
+ # Artifact is not currently required but it may be requested later.
+ # Keep it in the queue.
+ return QueueStatus.WAIT
+
# Optionally skip elements that are already in the artifact cache
if self._skip_cached:
if not element._can_query_cache():
diff --git a/buildstream/_scheduler/pullqueue.py b/buildstream/_scheduler/pullqueue.py
index 0d6b5dbfb..f9928a342 100644
--- a/buildstream/_scheduler/pullqueue.py
+++ b/buildstream/_scheduler/pullqueue.py
@@ -39,6 +39,11 @@ class PullQueue(Queue):
# state of dependencies may have changed, recalculate element state
element._update_state()
+ if not element._is_required():
+ # Artifact is not currently required but it may be requested later.
+ # Keep it in the queue.
+ return QueueStatus.WAIT
+
if not element._can_query_cache():
return QueueStatus.WAIT