summaryrefslogtreecommitdiff
path: root/buildstream/_pipeline.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2017-07-13 16:43:46 +0000
committerJürg Billeter <j@bitron.ch>2017-08-02 11:29:31 +0100
commitb86c9a5cbff7335aa45e0a012e82026c41fde033 (patch)
treed165c48eda20e7dfd223f9a2248dd036ecba77ce /buildstream/_pipeline.py
parente28852ee2cf0aaafd4e17df9156e8e167e6c8d38 (diff)
downloadbuildstream-sam/bst-push.tar.gz
Add initial `bst push` commandsam/bst-push
This is mainly useful for testing artifact caches and such. Most users will hopefully be able to make use of artifact caches populated by automated build machines, but right now it's unlikely that most people will be pushing artifacts around.
Diffstat (limited to 'buildstream/_pipeline.py')
-rw-r--r--buildstream/_pipeline.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py
index 64ce4d679..8092340fc 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)
+ # push()
+ #
+ # Pushes elements in the pipeline
+ #
+ # Args:
+ # scheduler (Scheduler): The scheduler to run this pipeline on
+ # elements (list): List of elements to push
+ #
+ def push(self, scheduler, elements):
+
+ if not self.artifacts.can_push():
+ self.message(self.target, MessageType.FAIL, "Not configured for pushing artifacts")
+
+ plan = elements
+ self.assert_consistent(plan)
+ self.session_elements = len(plan)
+
+ push = PushQueue()
+ push.enqueue(plan)
+ queues = [push]
+
+ self.message(self.target, MessageType.START, "Pushing {} artifacts".format(len(plan)))
+ elapsed, status = scheduler.run(queues)
+ pushed = len(push.processed_elements)
+
+ if status == SchedStatus.ERROR:
+ self.message(self.target, MessageType.FAIL, "Push failed", elapsed=elapsed)
+ raise PipelineError()
+ elif status == SchedStatus.TERMINATED:
+ self.message(self.target, MessageType.WARN,
+ "Terminated after pushing {} elements".format(pushed),
+ elapsed=elapsed)
+ raise PipelineError()
+ else:
+ self.message(self.target, MessageType.SUCCESS,
+ "Pushed {} complete".format(pushed),
+ elapsed=elapsed)
+
# remove_elements():
#
# Internal function