Skip to content

Commit 9351491

Browse files
committed
Emulate the new behavior in the mock Dispatch service
1 parent d919a77 commit 9351491

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/dispatch/test/service.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def Dispatch(self, request: dispatch_pb.DispatchRequest, context):
110110
run_request = function_pb.RunRequest(
111111
function=call.function,
112112
input=call.input,
113+
dispatch_id=dispatch_id,
114+
root_dispatch_id=dispatch_id,
113115
)
114116
self.queue.append((dispatch_id, run_request, CallType.CALL))
115117

@@ -207,6 +209,8 @@ def dispatch_calls(self):
207209
assert dispatch_id not in self.pollers
208210
poller = Poller(
209211
id=dispatch_id,
212+
parent_id=request.parent_dispatch_id,
213+
root_id=request.root_dispatch_id,
210214
function=request.function,
211215
coroutine_state=response.poll.coroutine_state,
212216
waiting={},
@@ -219,6 +223,9 @@ def dispatch_calls(self):
219223
child_request = function_pb.RunRequest(
220224
function=call.function,
221225
input=call.input,
226+
dispatch_id=child_dispatch_id,
227+
parent_dispatch_id=request.dispatch_id,
228+
root_dispatch_id=request.root_dispatch_id,
222229
)
223230

224231
_next_queue.append(
@@ -239,6 +246,9 @@ def dispatch_calls(self):
239246
tail_call_request = function_pb.RunRequest(
240247
function=tail_call.function,
241248
input=tail_call.input,
249+
dispatch_id=request.dispatch_id,
250+
parent_dispatch_id=request.parent_dispatch_id,
251+
root_dispatch_id=request.root_dispatch_id,
242252
)
243253
_next_queue.append((dispatch_id, tail_call_request, CallType.CALL))
244254

@@ -269,6 +279,9 @@ def dispatch_calls(self):
269279
len(poller.results),
270280
)
271281
poll_results_request = function_pb.RunRequest(
282+
dispatch_id=poller.id,
283+
parent_dispatch_id=poller.parent_id,
284+
root_dispatch_id=poller.root_id,
272285
function=poller.function,
273286
poll_result=poll_pb.PollResult(
274287
coroutine_state=poller.coroutine_state,
@@ -349,6 +362,9 @@ def __exit__(self, exc_type, exc_val, exc_tb):
349362
@dataclass
350363
class Poller:
351364
id: DispatchID
365+
parent_id: DispatchID
366+
root_id: DispatchID
367+
352368
function: str
353369

354370
coroutine_state: bytes

0 commit comments

Comments
 (0)