From e5e9ee3e0a5ccbeb049cbb4143549e1585702f06 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Tue, 9 Jul 2019 13:39:17 +0100 Subject: job: try pickling child jobs if BST_TEST_SUITE If we're running BuildStream tests then pickle child jobs. This ensures that we keep things picklable, whilst we work towards being able to support platforms that need to use the 'spawn' method of starting processes. --- src/buildstream/_scheduler/jobs/job.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/buildstream/_scheduler/jobs/job.py b/src/buildstream/_scheduler/jobs/job.py index 87f461939..7975488ed 100644 --- a/src/buildstream/_scheduler/jobs/job.py +++ b/src/buildstream/_scheduler/jobs/job.py @@ -34,6 +34,8 @@ from ..._exceptions import ImplError, BstError, set_last_task_error, SkipJob from ..._message import Message, MessageType, unconditional_messages from ... import _signals, utils +from .jobpickler import pickle_child_job + # Return code values shutdown of job handling child processes # @@ -179,6 +181,11 @@ class Job(): self._task_id, ) + # Make sure that picklability doesn't break, by exercising it during + # our test suite. + if self._scheduler.context.is_running_in_test_suite: + pickle_child_job(child_job, self._scheduler.context.get_projects()) + self._process = Process(target=child_job.child_action, args=[self._queue]) # Block signals which are handled in the main process such that -- cgit v1.2.1