You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:22:34 UTC
[buildstream] 01/22: optionpool: make OptionPool picklable
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch aevri/win32_minimal_seemstowork_20190829
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 0ca2aa605b813d0012921ea82f0687db2b2f87e3
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Thu Jun 27 14:04:52 2019 +0100
optionpool: make OptionPool picklable
In order to enable the 'spawn' method of creating jobs, make sure that
OptionPool is pickable, otherwise it cannot be sent to the job process.
---
src/buildstream/_options/optionpool.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/buildstream/_options/optionpool.py b/src/buildstream/_options/optionpool.py
index de3af3e..d5dea39 100644
--- a/src/buildstream/_options/optionpool.py
+++ b/src/buildstream/_options/optionpool.py
@@ -56,6 +56,18 @@ class OptionPool():
self._environment = jinja2.Environment(undefined=jinja2.StrictUndefined)
self._environment.globals = []
+ def __getstate__(self):
+ state = self.__dict__.copy()
+ del state['_environment']
+ return state
+
+ def __setstate__(self, state):
+ self.__dict__.update(state)
+
+ # jinja2 environment, with default globals cleared out of the way
+ self._environment = jinja2.Environment(undefined=jinja2.StrictUndefined)
+ self._environment.globals = []
+
# load()
#
# Loads the options described in the project.conf