Skip to content

Commit d919a77

Browse files
committed
Export the new fields
1 parent 2daeda8 commit d919a77

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/dispatch/proto.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import tblib # type: ignore[import-untyped]
1313
from google.protobuf import descriptor_pool, duration_pb2, message_factory
1414

15+
from dispatch.id import DispatchID
1516
from dispatch.sdk.v1 import call_pb2 as call_pb
1617
from dispatch.sdk.v1 import error_pb2 as error_pb
1718
from dispatch.sdk.v1 import exit_pb2 as exit_pb
@@ -52,6 +53,8 @@ class Input:
5253

5354
__slots__ = (
5455
"dispatch_id",
56+
"parent_dispatch_id",
57+
"root_dispatch_id",
5558
"_has_input",
5659
"_input",
5760
"_coroutine_state",
@@ -61,6 +64,8 @@ class Input:
6164

6265
def __init__(self, req: function_pb.RunRequest):
6366
self.dispatch_id = req.dispatch_id
67+
self.parent_dispatch_id = req.parent_dispatch_id
68+
self.root_dispatch_id = req.root_dispatch_id
6469

6570
self._has_input = req.HasField("input")
6671
if self._has_input:
@@ -288,6 +293,7 @@ class CallResult:
288293
correlation_id: Optional[int] = None
289294
output: Optional[Any] = None
290295
error: Optional[Error] = None
296+
dispatch_id: DispatchID = ""
291297

292298
def _as_proto(self) -> call_pb.CallResult:
293299
output_any = None
@@ -298,7 +304,10 @@ def _as_proto(self) -> call_pb.CallResult:
298304
error_proto = self.error._as_proto()
299305

300306
return call_pb.CallResult(
301-
correlation_id=self.correlation_id, output=output_any, error=error_proto
307+
correlation_id=self.correlation_id,
308+
output=output_any,
309+
error=error_proto,
310+
dispatch_id=self.dispatch_id,
302311
)
303312

304313
@classmethod
@@ -311,7 +320,10 @@ def _from_proto(cls, proto: call_pb.CallResult) -> CallResult:
311320
error = Error._from_proto(proto.error)
312321

313322
return CallResult(
314-
correlation_id=proto.correlation_id, output=output, error=error
323+
correlation_id=proto.correlation_id,
324+
output=output,
325+
error=error,
326+
dispatch_id=proto.dispatch_id,
315327
)
316328

317329
@classmethod

0 commit comments

Comments
 (0)