This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch aevri/picklable_jobs in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 44b3ed5a8d9c2b2d616da15fe90b284499eaa714 Author: Angelos Evripiotis <[email protected]> AuthorDate: Wed Apr 10 12:59:21 2019 +0100 TEMP: time and size of pickling and spawning --- src/buildstream/_scheduler/jobs/job.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/buildstream/_scheduler/jobs/job.py b/src/buildstream/_scheduler/jobs/job.py index 6f76825..a1c1e57 100644 --- a/src/buildstream/_scheduler/jobs/job.py +++ b/src/buildstream/_scheduler/jobs/job.py @@ -166,12 +166,30 @@ class Job(): # self._process = Process(target=child_job._child_action) + import contextlib + import time + @contextlib.contextmanager + def timer(message): + then = time.time() + yield + now = time.time() + print(f"({now - then:,.2}s):", message) + + import buildstream.testpickle + with timer(f"Pickle {self._child_action}"): + pickled_process = buildstream.testpickle.test_pickle_direct(self._child_action) + print(f"Size of pickled data: {len(pickled_process.getbuffer()):,}") + import pickle + pickled_process.seek(0) + # unpickled_process = pickle.load(pickled_process) + # Block signals which are handled in the main process such that # the child process does not inherit the parent's state, but the main # process will be notified of any signal after we launch the child. # - with _signals.blocked([signal.SIGINT, signal.SIGTSTP, signal.SIGTERM], ignore=False): - self._process.start() + with timer(f"process.start {self}"): + with _signals.blocked([signal.SIGINT, signal.SIGTSTP, signal.SIGTERM], ignore=False): + self._process.start() # Wait for the child task to complete. #
