-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to set ZMQ HWM for Eye Streams #1895
Conversation
@moiri Hi, could you elaborate on the use case of these features? In which cases do you think is it necessary to change the zmq hwm from its default value to a custom one? And is it necessary to be able to do so dynamically? Or do you think it would be possible to hardcode a specific hwm that fits better than the default one? |
@papr I have a scenario where I always need the latest data sample from the device. I prioritize latency over throughput, hence I don't want to fill up the buffer with "old" data which I first have to process before getting to the latest data sample. I would like to set the HWM to 1 (minimum). This may result in the loss of some data samples which is ok as long as I always get the latest sample. Being able to set this dynamically is not necessary. For my purpose it would be sufficient to set it during initialization (i.e. with the notification Should I remove the dynamic parts (GUI and |
I am not sure if setting the HWM to 1 does what you intend. Looking at https://rfc.zeromq.org/spec/29/#the-pub-socket-type I see
The queue in your case would have a length of 1 and would be full most of the time. If I understand the document correctly, you would be dropping newer data instead of replacing old data in the sending queue. This is not what you intended by setting the HWM to 1, correct? |
You are correct, but I have not found any way to overwrite the existing data in the queue. I can deal with one old data sample way better than with 1000 old data samples (which is the default). So HWM = 1 is not ideal but it is good enough for me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to reduce the PR to the minimal required amount of change to keep it as maintainable as possible. This means removing all possibilities to change the hwm dynamically. Additionally, I would like to give the variable a more explicit name.
You can apply the suggestions using the Github webinterface if you agree with the changes. I would appreciate it if you could give this an other test run after applying the changes in case I made a mistake while typing the suggestions.
Co-authored-by: Pablo Prietz <pablo@prietz.org>
Co-authored-by: Pablo Prietz <pablo@prietz.org>
change the variable `hwm` to the more explicit `pub_socket_hwm` Co-authored-by: Pablo Prietz <pablo@prietz.org>
remove dynamic pub_socket_hwm changes Co-authored-by: Pablo Prietz <pablo@prietz.org>
Remove unused attribute Co-authored-by: Pablo Prietz <pablo@prietz.org>
Thanks for the suggestions and the fast replies! |
@moiri Gratulations to your first Pupil project source code contribution! Thank you very much! |
Allow to change the socket option HWM for the eye data streams
eye_process.should_start
with the fieldhwm
eye_stream.set_zmq_option.hwm
(this will cause a ZMQ reconnection)