diff options
author | Jürg Billeter <j@bitron.ch> | 2017-08-01 14:22:02 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2017-08-02 11:30:29 +0100 |
commit | 3f0417c9ffbe2e6f86ae180169908e92f9622133 (patch) | |
tree | dfb935dcb8ac3c693582457c3fee009368916926 /buildstream/_pipeline.py | |
parent | b86c9a5cbff7335aa45e0a012e82026c41fde033 (diff) | |
download | buildstream-bst-pull.tar.gz |
Add initial `bst pull` commandbst-pull
Diffstat (limited to 'buildstream/_pipeline.py')
-rw-r--r-- | buildstream/_pipeline.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index 8092340fc..3c65e0967 100644 --- a/buildstream/_pipeline.py +++ b/buildstream/_pipeline.py @@ -631,6 +631,44 @@ class Pipeline(): self.open_workspace(scheduler, workspace_dir, source_index, no_checkout, track, False) + # pull() + # + # Pulls elements from the pipeline + # + # Args: + # scheduler (Scheduler): The scheduler to run this pipeline on + # elements (list): List of elements to pull + # + def pull(self, scheduler, elements): + + if not self.artifacts.can_fetch(): + self.message(self.target, MessageType.FAIL, "Not configured for pulling artifacts") + + plan = elements + self.assert_consistent(plan) + self.session_elements = len(plan) + + pull = PullQueue() + pull.enqueue(plan) + queues = [pull] + + self.message(self.target, MessageType.START, "Pulling {} artifacts".format(len(plan))) + elapsed, status = scheduler.run(queues) + pulled = len(pull.processed_elements) + + if status == SchedStatus.ERROR: + self.message(self.target, MessageType.FAIL, "Pull failed", elapsed=elapsed) + raise PipelineError() + elif status == SchedStatus.TERMINATED: + self.message(self.target, MessageType.WARN, + "Terminated after pulling {} elements".format(pulled), + elapsed=elapsed) + raise PipelineError() + else: + self.message(self.target, MessageType.SUCCESS, + "Pulled {} complete".format(pulled), + elapsed=elapsed) + # push() # # Pushes elements in the pipeline |