我正在通过python通过gremlin查询使用海王星的图数据库,以将地址存储在数据库中。大多数查询执行正常,但是一旦尝试以下查询,海王星就会返回内部故障异常:
g.V(address).outE('isPartOf').inV().
dedup().as_('groupNode').
inE('isPartOf').outV().dedup().as_('children').
addE('isPartOf').to(group).
select('groupNode').drop().
fold().
coalesce(__.unfold(),
g.V(address).addE('isPartOf').to(group)).next()
每个地址都有可能属于一个组。当地址已经分配给一个组时,我尝试将所有分配给该组的地址都分配给一个新组,同时删除旧组。如果该地址尚未分配给一个组,我只是想立即将该地址分配给新组。
如果我自己尝试此查询,则所有命令执行均会完美(尽管这是一个缓慢的查询)。但是,一旦我尝试在更多地址上并行执行此查询,此查询就会失败,并显示以下错误:
Traceback (most recent call last):
File "/usr/lib64/python2.7/threading.py", line 804, in __bootstrap_inner
self.run()
File "gremlinExample.py", line 30, in run
processTx(self.tx, self.g, self.parentBlock)
File "gremlinExample.py", line 152, in processTx
g.V(address).outE('isPartOf').inV().dedup().as_('groupNode').inE('isPartOf').outV().dedup().as_('children').select('children').addE('isPartOf').to(group).select('groupNode').drop().fold().coalesce(__.unfold(), g.V(address).addE('isPartOf').to(group)).next()
File "/home/ec2-user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py", line 70, in next
return self.__next__()
File "/home/ec2-user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py", line 43, in __next__
self.traversal_strategies.apply_strategies(self)
File "/home/ec2-user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py", line 346, in apply_strategies
traversal_strategy.apply(traversal)
File "/home/ec2-user/.local/lib/python2.7/site-packages/gremlin_python/driver/remote_connection.py", line 143, in apply
remote_traversal = self.remote_connection.submit(traversal.bytecode)
File "/home/ec2-user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py", line 54, in submit
results = result_set.all().result()
File "/usr/lib/python2.7/site-packages/concurrent/futures/_base.py", line 405, in result
return self.__get_result()
File "/usr/lib/python2.7/site-packages/concurrent/futures/_base.py", line 357, in __get_result
raise type(self._exception), self._exception, self._traceback
GremlinServerError: 500: {"requestId":"a42015b7-6b22-4bd1-9e7d-e3252e8f3ab6","code":"InternalFailureException","detailedMessage":"Can not get the attachable from the host vertex: v[64b32957-ef71-be47-c8d7-0109cfc4d9fd]-/->neptunegraph[org.apache.commons.configuration.PropertiesConfiguration@6db0f02]"}
据我所知,并行执行不是问题,因为每个查询都只是在数据库中排队(正是出于这个原因,我试图创建一个可以立即执行整个任务的查询)。
为任何不良英语找借口,这不是我的母语
答案 0 :(得分:0)
对于在此处寻求更新的其他任何人-OP可以通过将.next()替换为.iterate()来解决此问题。为了更好地理解查询和数据,需要进行一些后续操作,但是OP放弃了该项目,转而使用另一种解决方案。