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:40:39 UTC
[buildstream] 27/27: WIP: also pickle DigestProto
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch aevri/check_spawn_ci_working
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit a258c49e3436e0e8da8ceaf041ef763cffe1a120
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Thu Oct 17 11:54:00 2019 +0100
WIP: also pickle DigestProto
---
src/buildstream/_scheduler/jobs/jobpickler.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/buildstream/_scheduler/jobs/jobpickler.py b/src/buildstream/_scheduler/jobs/jobpickler.py
index 13ad2d0..4eb915e 100644
--- a/src/buildstream/_scheduler/jobs/jobpickler.py
+++ b/src/buildstream/_scheduler/jobs/jobpickler.py
@@ -23,6 +23,7 @@ import io
import pickle
from ..._protos.buildstream.v2.artifact_pb2 import Artifact as ArtifactProto
+from ..._protos.build.bazel.remote.execution.v2.remote_execution_pb2 import Digest as DigestProto
# BuildStream toplevel imports
from ..._loader import Loader
@@ -100,6 +101,7 @@ def pickle_child_job(child_job, projects):
for cls in source_classes:
pickler.dispatch_table[cls] = _reduce_plugin
pickler.dispatch_table[ArtifactProto] = _reduce_artifact_proto
+ pickler.dispatch_table[DigestProto] = _reduce_digest_proto
pickler.dispatch_table[Loader] = _reduce_object
pickler.dispatch_table[Messenger] = _reduce_object
@@ -127,6 +129,18 @@ def _new_artifact_proto_from_reduction_args(data):
return instance
+def _reduce_digest_proto(instance):
+ assert isinstance(instance, DigestProto)
+ data = instance.SerializeToString()
+ return (_new_digest_proto_from_reduction_args, (data,))
+
+
+def _new_digest_proto_from_reduction_args(data):
+ instance = DigestProto()
+ instance.ParseFromString(data)
+ return instance
+
+
def _reduce_plugin(plugin):
project, meta_kind, state = plugin._get_args_for_child_job_pickling()
assert project