Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Object model subscription - sometimes fails

    Scheduled Pinned Locked Moved
    DSF Development
    3
    11
    659
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • chrishammundefined
      chrishamm administrators @Lem
      last edited by

      @Lem Pressing emergency stop resets DCS and all connected IPC sockets.

      Duet software engineer

      Lemundefined 1 Reply Last reply Reply Quote 0
      • Lemundefined
        Lem @chrishamm
        last edited by

        @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.

        chrishammundefined Falcounetundefined 2 Replies Last reply Reply Quote 0
        • chrishammundefined
          chrishamm administrators @Lem
          last edited by

          @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?

          Duet software engineer

          Falcounetundefined 1 Reply Last reply Reply Quote 1
          • Falcounetundefined
            Falcounet @chrishamm
            last edited by

            @chrishamm @Lem I'm going to look at this

            1 Reply Last reply Reply Quote 0
            • Falcounetundefined
              Falcounet @Lem
              last edited by

              @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.

              Lemundefined 1 Reply Last reply Reply Quote 3
              • Lemundefined
                Lem
                last edited by

                I've just implemented checking for an exception. I will let you know about the test results!

                1 Reply Last reply Reply Quote 0
                • Lemundefined
                  Lem @Falcounet
                  last edited by Lem

                  @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:
                  unnamed (2).jpg

                  Lemundefined 1 Reply Last reply Reply Quote 0
                  • Lemundefined
                    Lem @Lem
                    last edited by

                    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?

                    Falcounetundefined 1 Reply Last reply Reply Quote 0
                    • Falcounetundefined
                      Falcounet @Lem
                      last edited by

                      @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.

                      Lemundefined 1 Reply Last reply Reply Quote 0
                      • Lemundefined
                        Lem @Falcounet
                        last edited by

                        @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()
                                  [...]
                        
                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA