You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Janne Pänkälä (Jira)" <ji...@apache.org> on 2020/05/12 17:53:00 UTC
[jira] [Created] (TINKERPOP-2370) Unable to set the server side
script timeout in gremlin-python
Janne Pänkälä created TINKERPOP-2370:
-----------------------------------------
Summary: Unable to set the server side script timeout in gremlin-python
Key: TINKERPOP-2370
URL: https://issues.apache.org/jira/browse/TINKERPOP-2370
Project: TinkerPop
Issue Type: Improvement
Components: python
Affects Versions: 3.4.6
Environment: python
Reporter: Janne Pänkälä
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]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)