diff options
author | Benjamin Schubert <contact@benschubert.me> | 2020-03-26 09:09:04 +0000 |
---|---|---|
committer | Tristan van Berkom <tristan@codethink.co.uk> | 2020-11-04 16:23:00 +0900 |
commit | 1dc48793e42f54a8cdcba30b8dd21b52c5bac7f0 (patch) | |
tree | c64cad2d41e3a80bf8ca37a22b881165276dcdb2 /src | |
parent | 5d51b8d00ff5de466521cdecb42dda1550e787d8 (diff) | |
download | buildstream-1dc48793e42f54a8cdcba30b8dd21b52c5bac7f0.tar.gz |
_stream.py: Make `_enqueue_plan` a timed activitybschubert/notify-prepare-plan
This enqueue_plan can take a long time, as it triggers a verification
of the 'cached' state for sources in some cases, which can take a long
time.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_scheduler/queues/queue.py | 6 | ||||
-rw-r--r-- | src/buildstream/_stream.py | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/buildstream/_scheduler/queues/queue.py b/src/buildstream/_scheduler/queues/queue.py index f5aa2ca4c..e05d95188 100644 --- a/src/buildstream/_scheduler/queues/queue.py +++ b/src/buildstream/_scheduler/queues/queue.py @@ -174,13 +174,17 @@ class Queue: # # Args: # elts (list): A list of Elements + # task (Task): The task to add progress to for the UI, if any # - def enqueue(self, elts): + def enqueue(self, elts, task=None): if not elts: return # Obtain immediate element status for elt in elts: + if task: + task.add_current_progress() + if self._required_element_check and not elt._is_required(): elt._set_required_callback(self._enqueue_element) else: diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index af0537fe1..0a055a76d 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -1299,7 +1299,11 @@ class Stream: # def _enqueue_plan(self, plan, *, queue=None): queue = queue or self.queues[0] - queue.enqueue(plan) + + with self._context.messenger.simple_task("Preparing work plan") as task: + task.set_maximum_progress(len(plan)) + queue.enqueue(plan, task) + self.session_elements += plan # _failure_retry() |