class AgentHandle(protocol.agent_capnp.Process.CallbackTarget.Server):
def __init__(self, agent):
self.agent = agent
self.queue_action = asyncio.Queue(maxsize=5)
assert 'sendTarget' in protocol.agent_capnp.Process.CallbackTarget.schema.method_names
async def start(self, callback_action):
while response := await self.queue_action.get() is not None:
result = callback_action.sendAction(response=response)
respond = await result.a_wait()
def sendTarget(self, target, **args):
... # Query the agent about the target
await self.queue_action.put(...)
This is in the main function
agent_handle = AgentHandle(agent)
stream_reply: capnp.Promise = server.stream(
callbackTarget=agent_handle
)
logging.info("Calling server to start tactic stream")
stream_reply = await stream_reply.a_wait()
# The server shows that the above `.stream` call has been received
callback_action = stream_reply.callbackAction
logging.info("Starting stream ...")
await agent_handle.start(callback_action)
However the sendTarget function is never called, and the server I have (in rust) shows that the sendTarget promise never returns when .await is called on it. Is there a general method for debugging this type of problems?
Is there a way to debug capnp to see which function is called?
In my use case, I have a schema like this for bidirectional streaming:
and a client (simplified version)
This is in the main function
However the
sendTarget
function is never called, and the server I have (in rust) shows that thesendTarget
promise never returns when.await
is called on it. Is there a general method for debugging this type of problems?