Object model subscription - sometimes fails
-
@Lem Pressing emergency stop resets DCS and all connected IPC sockets.
-
@chrishamm Ok, but it's hard to recognize when script get stuck. Function get_object_model() don't raise any error... Beside this printing works properly so I wouldn't like to reset printer.
-
@Lem I'm sorry but I confirm that. The original DSF demo application shuts down properly when DCS is terminated on E-STOP. I'd expect the Python library to generate an event/error as well when the socket is closed. @Falcounet can you check this please?
-
@chrishamm @Lem I'm going to look at this
-
@Lem I just releaseed a new version of dsf-python which raises an
dsf.connections.exceptions.IPCSocketBrokenException
exception when the IPC socket is closed.
Please try and report back if you run in other problems. -
I've just implemented checking for an exception. I will let you know about the test results!
-
@Falcounet I think that your solution works - I can't register exception handling but I don't experience so many stucks. Did you improve something more? I will let you know if I am sure. But...
Function again gets stuck for ~3 min and I closed it. Problem appear in connect function this time.DSF 3.4.6 and dsf-python-3.4.6.post4
Error:
-
The problem with get_object_model() has been resolved, but I'm still stuck with connect(). Can you add an exception in this function as well?
-
@Lem said in Object model subscription - sometimes fails:
The problem with get_object_model() has been resolved, but I'm still stuck with connect(). Can you add an exception in this function as well?
Given the traceback above, the socket is waiting to receive data so I guess a timeout is what is needed. Although the socket is currently in blocking mode so setting a timeout won't work.
Are you able to reproduce this problem ?
If so, please post a snippet I can use to try a fix. -
@Falcounet Ok, I try to reproduce error and save snippet but probably I will post the same info like on photo above.
Apart from this, can you tell which way of object model subscription is the best?
Option 1:
if __name__ == "__main__": subscribe_connection = SubscribeConnection(SubscriptionMode.FULL) subscribe_connection.connect() while True: time.sleep(1.0) object_model = subscribe_connection.get_object_model() [...] if script_end == True: subscribe_connection.close()
Option 2:
if __name__ == "__main__": subscribe_connection = SubscribeConnection(SubscriptionMode.FULL) while True: time.sleep(1.0) subscribe_connection.connect() object_model = subscribe_connection.get_object_model() subscribe_connection.close() [...]
Option 3:
if __name__ == "__main__": while True: time.sleep(1.0) subscribe_connection = SubscribeConnection(SubscriptionMode.FULL) subscribe_connection.connect() object_model = subscribe_connection.get_object_model() subscribe_connection.close() [...]