Gremlin Python连接失败后挂起

时间:2018-10-12 12:42:55

标签: python connection gremlin connection-pool

如果gremlin提交由于某种原因而失败(在这里我具体是通过尝试再次插入相同的ID使其失败)大于pool_size,则下一个提交调用失败。

我很清楚在每次失败连接后都不会释放回池。但是我该怎么办?

>>> from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
>>> from gremlin_python.structure.graph import Graph
>>> from gremlin_python.process.traversal import T
>>>
>>> NEPTUNE_END_POINT = 'ws://127.0.0.1:8182/gremlin'
>>> graph = Graph()
>>> g = graph.traversal().withRemote(DriverRemoteConnection(NEPTUNE_END_POINT, 'g',pool_size=2))
>>>
>>> g.addV('test1').property(T.id,'id1').toList()
[v[id1]]
>>> g.addV('test1').property(T.id,'id1').toList()
Traceback (most recent call last):
  ...
gremlin_python.driver.protocol.GremlinServerError: 499: {"requestId":"1a357c30-6595-437b-864d-f69e0ae6556c","detailedMessage":"Vertex with id already exists: id1","code":"ConstraintViolationException"}
>>> g.addV('test1').property(T.id,'id1').toList()
Traceback (most recent call last):
  ...
gremlin_python.driver.protocol.GremlinServerError: 499: {"requestId":"27005abb-17fc-4603-aa35-05104236e1a8","detailedMessage":"Vertex with id already exists: id1","code":"ConstraintViolationException"}
>>> g.addV('test1').property(T.id,'id1').toList() # Hangs here

0 个答案:

没有答案