summaryrefslogtreecommitdiff
path: root/src/buildstream/_scheduler/queues/sourcepushqueue.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/sourcepushqueue.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/sourcepushqueue.py')
-rw-r--r--src/buildstream/_scheduler/queues/sourcepushqueue.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/buildstream/_scheduler/queues/sourcepushqueue.py b/src/buildstream/_scheduler/queues/sourcepushqueue.py
index c38460e6a..f0926654c 100644
--- a/src/buildstream/_scheduler/queues/sourcepushqueue.py
+++ b/src/buildstream/_scheduler/queues/sourcepushqueue.py
@@ -30,13 +30,16 @@ class SourcePushQueue(Queue):
complete_name = "Sources pushed"
resources = [ResourceType.UPLOAD]
- def process(self, element):
- # Returns whether a source was pushed or not
- if not element._source_push():
- raise SkipJob(self.action_name)
+ def get_process_func(self):
+ return SourcePushQueue._raise_skip_if_not_pushed
def status(self, element):
if element._skip_source_push():
return QueueStatus.SKIP
return QueueStatus.READY
+
+ @staticmethod
+ def _raise_skip_if_not_pushed(element):
+ if not element._source_push():
+ raise SkipJob(SourcePushQueue.action_name)