European-XFEL / karabo-bridge-py

Tools to allow data exchange with Karabo, in particular streaming of data
BSD 3-Clause "New" or "Revised" License
9 stars 4 forks source link

Context manager #21

Closed tmichela closed 6 years ago

takluyver commented 6 years ago

Just to make it clear, for data in client doesn't give you any way to catch an error and continue the loop - an exception would immediately break you out of the loop. Hopefully that's not a concern, but worth being aware of.

Also, I wonder if for data in client will make people expect that the loop exits when the data is 'finished' (e.g. run finished, or server shut down). Currently I think it will just hang indefinitely in that case. In a future revision of the protocol, it may make sense to add a way for the server to say that this is the end, and the client should not wait for more data.

tmichela commented 6 years ago

This is a good point, there is a way to signal the end of data stream, and the server side is ready to sned it (we would need to update the client). Unfortunately the DAQ is not using it at the moment... not sure if this is planned in near future

takluyver commented 6 years ago

LGTM