summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2019-07-09 13:39:17 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-24 12:27:10 +0000
commite5e9ee3e0a5ccbeb049cbb4143549e1585702f06 (patch)
tree48ab433c7527977fcfe60417848b0dbd7cb26b4a
parentd3e7857a1eabd06d9d15ca6c201ed7b66064cc98 (diff)
downloadbuildstream-aevri/pickle.tar.gz
job: try pickling child jobs if BST_TEST_SUITEaevri/pickle
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.
-rw-r--r--src/buildstream/_scheduler/jobs/job.py7
1 files changed, 7 insertions, 0 deletions
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