slac-lcls / ami

Other
6 stars 3 forks source link

Reconnect a terminal to a different output does not work well #83

Open vespos opened 1 month ago

vespos commented 1 month ago

Describe the bug When disconnecting a terminal and reconnecting it to another box, the underlying subprocess might not update itself correctly. This seems to be linked to the fact that the Flowchart does not communicate the updated topology to the Node's subprocess. This results in the mapping of the terminal to the internal variables not working properly, and being overwritten.

Solution might involve replicating some of the step in the build_views function of the FlowchartWidget, in particular self.chart.broker.send_pyobj(fcMsgs.DisplayNode(**args))

For now, deleting the problematic node (typically a filter box) and making a new one does allow one to move past the issue.

syamajala commented 1 week ago

It seems like we should be blocking signals here: https://github.com/slac-lcls/ami/blob/master/ami/client/flowchart.py#L233

Right now that causes a checkpoint to be sent on display, which I dont think we should be doing.

Another issue I found is that custom widgets seem to be sending checkpoints as many times as you open and close the window. The filter widget for example if you open it and close it then change a control in the widget it will emit 2 signals for the state changed. I'm not sure why. I can also reproduce this with the calculator.

syamajala commented 5 days ago

I think I know what the bug is. We create the widget in two places. One in the subprocess and one in the Flowchart class. The one in the subprocess is getting updated when we close the window and reopen it, but the one in the Flowchart never does. We probably need to a send a message to the flowchart when the window gets closed to destroy the widget.