44import base64
55from threading import Event
66from typing import Optional
7+ from durabletask import task
78from durabletask .internal .orchestrator_service_pb2 import EntityBatchRequest , EntityBatchResult , OrchestratorRequest , OrchestratorResponse
89from durabletask .worker import _Registry , ConcurrencyOptions
910from durabletask .internal import shared
@@ -33,10 +34,10 @@ def __init__(self):
3334
3435 self ._interceptors = None
3536
36- def add_named_orchestrator (self , name : str , func ):
37+ def add_named_orchestrator (self , name : str , func : task . Orchestrator ):
3738 self ._registry .add_named_orchestrator (name , func )
3839
39- def _execute_orchestrator (self , func , context ) -> str :
40+ def _execute_orchestrator (self , func : task . Orchestrator , context ) -> str :
4041 context_body = getattr (context , "body" , None )
4142 if context_body is None :
4243 context_body = context
@@ -67,9 +68,9 @@ def stub_complete(stub_response):
6768 if response is None :
6869 raise Exception ("Orchestrator execution did not produce a response." )
6970 # The Python worker returns the input as type "json", so double-encoding is necessary
70- return '"' + base64 .b64encode (response .SerializeToString ()).decode ('utf-8' ) + '"'
71+ return base64 .b64encode (response .SerializeToString ()).decode ('utf-8' )
7172
72- def _execute_entity_batch (self , func , context ) -> str :
73+ def _execute_entity_batch (self , func : task . Entity , context ) -> str :
7374 context_body = getattr (context , "body" , None )
7475 if context_body is None :
7576 context_body = context
@@ -90,4 +91,4 @@ def stub_complete(stub_response: EntityBatchResult):
9091 if response is None :
9192 raise Exception ("Entity execution did not produce a response." )
9293 # The Python worker returns the input as type "json", so double-encoding is necessary
93- return '"' + base64 .b64encode (response .SerializeToString ()).decode ('utf-8' ) + '"'
94+ return base64 .b64encode (response .SerializeToString ()).decode ('utf-8' )
0 commit comments