summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan van Berkom <tristan@codethink.co.uk>2020-12-02 16:58:41 +0900
committerTristan van Berkom <tristan@codethink.co.uk>2020-12-07 17:53:03 +0900
commit85bc237c684310a69fd3d05bb0124f7e100b5216 (patch)
tree07a934f064d243acc899481ab4f20ad115ee98a0 /src
parentfd298b1229ba697bcda4767388d6e5ddbcf107a0 (diff)
downloadbuildstream-85bc237c684310a69fd3d05bb0124f7e100b5216.tar.gz
_stream.py: Add _load_artifacts() here
Instead of having _pipeline.py implement load_artifacts() by calling _project.py's other implementation of load_artifacts(), instead just implement _load_artifacts() directly in _stream.py. This of course removes the load_artifacts() implementations from _pipeline.py and _project.py.
Diffstat (limited to 'src')
-rw-r--r--src/buildstream/_pipeline.py15
-rw-r--r--src/buildstream/_project.py21
-rw-r--r--src/buildstream/_stream.py21
3 files changed, 20 insertions, 37 deletions
diff --git a/src/buildstream/_pipeline.py b/src/buildstream/_pipeline.py
index 77b3c24e0..01ebc2e96 100644
--- a/src/buildstream/_pipeline.py
+++ b/src/buildstream/_pipeline.py
@@ -79,21 +79,6 @@ class Pipeline:
return tuple(element_groups)
- # load_artifacts()
- #
- # Loads ArtifactElements from target artifacts.
- #
- # Args:
- # target (list [str]): Target artifacts to load
- #
- # Returns:
- # (list [ArtifactElement]): A list of ArtifactElement objects
- #
- def load_artifacts(self, targets):
- # XXX: This is not included as part of the "load-pipeline" profiler, we could move
- # the profiler to Stream?
- return self._project.load_artifacts(targets)
-
# resolve_elements()
#
# Resolve element state and cache keys.
diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py
index 6154c51c0..180c23977 100644
--- a/src/buildstream/_project.py
+++ b/src/buildstream/_project.py
@@ -27,7 +27,6 @@ from . import utils
from . import _site
from . import _yaml
from .utils import UtilError
-from ._artifactelement import ArtifactElement
from ._profile import Topics, PROFILER
from ._exceptions import LoadError
from .exceptions import LoadErrorReason
@@ -455,26 +454,6 @@ class Project:
return elements
- # load_artifacts()
- #
- # Loads artifacts from target artifact refs
- #
- # Args:
- # targets (list): Target artifact refs
- #
- # Returns:
- # (list): A list of loaded ArtifactElement
- #
- def load_artifacts(self, targets):
- with self._context.messenger.simple_task("Loading artifacts") as task:
- artifacts = []
- for ref in targets:
- artifacts.append(ArtifactElement._new_from_artifact_name(ref, self._context, task))
-
- ArtifactElement._clear_artifact_refs_cache()
-
- return artifacts
-
# ensure_fully_loaded()
#
# Ensure project has finished loading. At first initialization, a
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 91d7cb122..222957c02 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -1086,6 +1086,25 @@ class Stream:
self.queues = [queue]
self._run()
+ # _load_artifacts()
+ #
+ # Loads artifacts from target artifact refs
+ #
+ # Args:
+ # artifact_names (list): List of target artifact names to load
+ #
+ # Returns:
+ # (list): A list of loaded ArtifactElement
+ #
+ def _load_artifacts(self, artifact_names):
+ with self._context.messenger.simple_task("Loading artifacts") as task:
+ artifacts = []
+ for artifact_name in artifact_names:
+ artifacts.append(ArtifactElement._new_from_artifact_name(artifact_name, self._context, task))
+
+ ArtifactElement._clear_artifact_refs_cache()
+ return artifacts
+
# _load_elements_from_targets
#
# Given the usual set of target element names/artifact refs, load
@@ -1125,7 +1144,7 @@ class Stream:
# Load artifacts
if refs:
- artifacts = self._pipeline.load_artifacts(refs)
+ artifacts = self._load_artifacts(refs)
else:
artifacts = []