feature: Support streaming device queries#95
Conversation
|
Ping on this if anyone has time to review and or test. |
polymerizedsage
left a comment
There was a problem hiding this comment.
I could successfully run a full streaming query after installing matplotlib. However if I ctrl + C during a query I get the following stacktrace, and no output file is saved:
Traceback (most recent call last):
File "/home/sage/synapse-client-python/.venv/bin/synapsectl", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/sage/synapse-client-python/synapse/cli/__main__.py", line 74, in main
args.func(args)
File "/home/sage/synapse-client-python/synapse/cli/rpc.py", line 112, in query
return client.stream_query(StreamQueryRequest(request=query_proto))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sage/synapse-client-python/synapse/cli/query.py", line 62, in stream_query
return self.handle_impedance_stream(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sage/synapse-client-python/synapse/cli/query.py", line 186, in handle_impedance_stream
for response in self.device.stream_query(request):
File "/home/sage/synapse-client-python/synapse/client/device.py", line 179, in stream_query
for response in self.rpc.StreamQuery(stream_request):
File "/home/sage/synapse-client-python/.venv/lib/python3.12/site-packages/grpc/_channel.py", line 543, in __next__
return self._next()
^^^^^^^^^^^^
File "/home/sage/synapse-client-python/.venv/lib/python3.12/site-packages/grpc/_channel.py", line 960, in _next
_common.wait(self._state.condition.wait, _response_ready)
File "/home/sage/synapse-client-python/.venv/lib/python3.12/site-packages/grpc/_common.py", line 156, in wait
_wait_once(wait_fn, MAXIMUM_WAIT_TIMEOUT, spin_cb)
File "/home/sage/synapse-client-python/.venv/lib/python3.12/site-packages/grpc/_common.py", line 116, in _wait_once
wait_fn(timeout=timeout)
File "/usr/lib/python3.12/threading.py", line 359, in wait
gotit = waiter.acquire(True, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
I think we should be able to handle this case since one of the main advantages of streaming queries is getting partial data back if a query fails.
|
I'm getting this error when a streaming query completes: |
|
I also still get the same stacktrace when ctrl + C'ing a running query. The output CSV does save however. |
polymerizedsage
left a comment
There was a problem hiding this comment.
Alongside the other comments some small changes.
I thought you just wanted to have the csv output - not silent keyboard. I can fix. |
|
Should be fixed now, sorry: |
* Better displays and plots * added logs while self test is running in verbose mode * added logs while self test is running in verbose mode * Added cli * Added better options for device log * updated the submodule * Updated synapse api * Updated api to main * Feedback from review * increase sleep * Updated from feedback * Feedback from review * Fixes during streaming
Summary
Self tests and impedance queries are long running, which can be confusing or concerning for the users. We add the option to stream query requests from a synapse device, which allows us to monitor the progress in real time. This PR updates the Python Client to reflect these changes.
Testing