Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2370

Unable to set the server side script timeout in gremlin-python

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.4.6
    • Fix Version/s: None
    • Component/s: python
    • Labels:
      None
    • Environment:
      python

      Description

      Currently one can set timeLimit() to limit how long query will run in the backend.

      This however has limitation that one cannot know if query was completed or not the server will just stop executing it and return whatever it has found by then.

       

      Server has query timeout and when that triggers one receives TimeLimitExceededException.

      There is a possibility to set the time limit PER query (or per connection?) by using 
      evaluationTimeout (or scriptEvaluationTimeout in older version)
       
      It would appear that these are read in the server at the TraversalOpProcessor.java:166
      and they COULD be set in gremlin_python/driver/client.py:119 along with 'gremlin' and 'aliases'
       
      I tried a minor mod
       
      message = request.RequestMessage(
        processor='traversal', op='bytecode',
        args=

      {'gremlin': message,      'aliases': \{'g': self._traversal_source}

      ,
           'evaluationTimeout': 1000,
           'scriptEvaluationTimeout': 1000,
      })
       
      Against AWS Neptune and that seemed to work out properly.
       
      Here it would be easy to read in os.environ.get('ARGS_EVAL_TIMEOUT') but that would make python library function differently from Java library.
       
       
      I tried to get it working with some variations of 
       
      return g.withStrategies(OptionsStrategy(options={"scriptEvaluationTimeout": 300, "evaluationTimeout": 300})).with_("scriptEvaluationTimeout", 300).with_("evaluationTimeout", 300).V().hasLabel('TestLabel').count()
       
      But closer inspection of the client.py implementation woke me to the fact that there just is no way to provide additional 'args' to the connection for TraversalOpProsessor to interpret.
       
      I could make a PR for this, but I am not certain as how this implementation would be preferred to happen.
       
       
      References.
      https://docs.aws.amazon.com/neptune/latest/userguide/best-practices-gremlin-java-per-query-timeout.html
      https://github.com/apache/tinkerpop/blob/master/docs/src/reference/gremlin-variants.asciidoc
       
       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                epankala Janne Pänkälä
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: