summaryrefslogtreecommitdiff
path: root/src/buildstream/_scheduler/queues/pullqueue.py
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2019-04-09 13:31:39 +0100
committerAngelos Evripiotis <jevripiotis@bloomberg.net>2019-07-04 11:06:46 +0100
commitdc9a98b13136247aa7603cc731611e08f1c4c6f9 (patch)
treebbbaa27cfb4a3785dda65ed7022eb59f72925667 /src/buildstream/_scheduler/queues/pullqueue.py
parent8632513034031e85878e91a4882e96f7760daa0f (diff)
downloadbuildstream-aevri/smallerjobs2.tar.gz
_scheduler: don't pass whole queue to child jobaevri/smallerjobs2
Stop passing the scheduler's job queue's across to child jobs, via the 'action_cb' parameter. Instead pass a module-level function, which will pickle nicely. This isn't much of a problem while we are in the 'fork' multiprocessing model. As we move towards supporting the 'spawn' model for win32, then we need to consider what we will be pickling and unpickling, to cross the process boundary.
Diffstat (limited to 'src/buildstream/_scheduler/queues/pullqueue.py')
-rw-r--r--src/buildstream/_scheduler/queues/pullqueue.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/buildstream/_scheduler/queues/pullqueue.py b/src/buildstream/_scheduler/queues/pullqueue.py
index 245293342..dfb00aa21 100644
--- a/src/buildstream/_scheduler/queues/pullqueue.py
+++ b/src/buildstream/_scheduler/queues/pullqueue.py
@@ -33,10 +33,8 @@ class PullQueue(Queue):
complete_name = "Pulled"
resources = [ResourceType.DOWNLOAD, ResourceType.CACHE]
- def process(self, element):
- # returns whether an artifact was downloaded or not
- if not element._pull():
- raise SkipJob(self.action_name)
+ def get_process_func(self):
+ return PullQueue._raise_skip_if_not_pulled
def status(self, element):
if not element._can_query_cache():
@@ -65,3 +63,8 @@ class PullQueue(Queue):
# immediately ready to query the artifact cache so that it
# may be pulled.
element._set_can_query_cache_callback(self._enqueue_element)
+
+ @staticmethod
+ def _raise_skip_if_not_pulled(element):
+ if not element._pull():
+ raise SkipJob(PullQueue.action_name)