Object model subscription - sometimes fails
-
Hello!
I would like to save some parameters during printing. I constantly read object model and save choosed values.
while True: subscribe_connection = SubscribeConnection(SubscriptionMode.PATCH) subscribe_connection.connect() try: object_model = subscribe_connection.get_object_model() finally: subscribe_connection.close() [...] layer_actual = object_model.job.layer
But sometimes python script get stuck:
^CTraceback (most recent call last): File "print_loger.py", line 43, in <module> object_model = subscribe_connection.get_object_model() File "/home/pi/.local/lib/python3.7/site-packages/dsf/connections/subscribe_co nnection.py", line 35, in get_object_model object_model = self.receive(ObjectModel) File "/home/pi/.local/lib/python3.7/site-packages/dsf/connections/base_connect ion.py", line 77, in receive json_string = self.receive_json() File "/home/pi/.local/lib/python3.7/site-packages/dsf/connections/base_connect ion.py", line 108, in receive_json part = self.socket.recv(BUFF_SIZE)
Now I'm working on 3.4.6 version.
What could be the reason of this behavior?
-
@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: