How to make gremlin_python DriverRemoteConnection to have timeout and retry limit for each submit?

Viewed 479

Disclaimer: We are currently using gremlinpython==3.4.8 and I believe some of this has been addressed in the more recent releases but I'm not sure. In general this seems like a very active repository with some relevant changes in the past two latest release logs (currently on 3.4.10). Happy to upgrade as needed.

Where is the documentation, or can you provide an example of instantiating a DriverRemoteConnection object that has the appropriate configuration to allow for retrying each query submission with NUM_RETRIES number of retries?

I am not sure which of these options applies in order to get the kind of behavior I want. https://tinkerpop.apache.org/docs/current/reference/#python-configuration

Maybe what makes sense is to override the submit method

Examples of how we currently instantiate DriverRemoteConnection object:

  •   gremlin_python.process.anonymous_traversal import traversal
      connection_object = traversal().withRemote(CONNECTION_STRING)
    
1 Answers

Where is the documentation, or can you provide an example of instantiating a DriverRemoteConnection object that has the appropriate configuration to allow for retrying each query submission with NUM_RETRIES number of retries?

There is no such configuration. Even for the Java driver, which is the most featured driver in the TinkerPop repository, there is no such feature. Request retries require application specific programming as server error messages and codes are not currently unified (see TINKERPOP-2517). Therefore, depending on the graph database you have chosen you would need to determine what error codes and/or messages you would retry on and code such application logic yourself. Hopefully that clarifies TinkerPop's position and the features of the drivers.

Related