diff options
author | James Ennis <james.ennis@codethink.co.uk> | 2019-08-30 15:26:23 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-09-04 12:05:49 +0000 |
commit | 6b3da9429b18d93e2f1348b5758536e981e3bec2 (patch) | |
tree | 675e4167d883344af3f1ffe3fb1401385664f938 /src | |
parent | 566a6a55d5d3c73809d6e43d819fa36702f0c231 (diff) | |
download | buildstream-6b3da9429b18d93e2f1348b5758536e981e3bec2.tar.gz |
_loader.py: Cache how many Elements we load
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_loader/loader.py | 6 | ||||
-rw-r--r-- | src/buildstream/_project.py | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/buildstream/_loader/loader.py b/src/buildstream/_loader/loader.py index 89458d40c..b2dc7c1c3 100644 --- a/src/buildstream/_loader/loader.py +++ b/src/buildstream/_loader/loader.py @@ -62,6 +62,7 @@ class Loader(): # Public members # self.project = project # The associated Project + self.loaded = None # The number of loaded Elements # # Private members @@ -146,6 +147,11 @@ class Loader(): self._clean_caches() + # Cache how many Elements have just been loaded + if task: + # Workaround for task potentially being None (because no State object) + self.loaded = task.current_progress + return ret # get_state_for_child_job_pickling(self) diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py index 00beebfab..9cff40868 100644 --- a/src/buildstream/_project.py +++ b/src/buildstream/_project.py @@ -434,13 +434,9 @@ class Project(): with self._context.messenger.simple_task("Loading elements", silent_nested=True) as task: meta_elements = self.loader.load(targets, rewritable=rewritable, ticker=None, task=task) - # workaround for task potentially being None (because no State object) - if task: - total_elements = task.current_progress - with self._context.messenger.simple_task("Resolving elements") as task: if task: - task.set_maximum_progress(total_elements) + task.set_maximum_progress(self.loader.loaded) elements = [ Element._new_from_meta(meta, task) for meta in meta_elements |