小精灵python不是可用的小精灵脚本

小精灵python不是可用的小精灵脚本,python,amazon-web-services,gremlin,amazon-neptune,gremlinpython,Python,Amazon Web Services,Gremlin,Amazon Neptune,Gremlinpython,我正在尝试使用gremlin python在AWS neptune上执行lambda函数。它击中了我gremlin python不是一个可用的GremlinScriptEngine。有人能帮忙解决这个问题吗。 g.V().out().map(lambda:lambda x:len(x.get().value('event'))))。toList() 图形中的每个顶点都包含一个事件属性,该属性为文本 执行的查询:g.V().out().map(lambda:lambda x:len(x.get()

我正在尝试使用gremlin python在AWS neptune上执行lambda函数。它击中了我
gremlin python不是一个可用的GremlinScriptEngine
。有人能帮忙解决这个问题吗。
g.V().out().map(lambda:lambda x:len(x.get().value('event'))))。toList()

图形中的每个顶点都包含一个
事件
属性,该属性为文本

执行的查询:
g.V().out().map(lambda:lambda x:len(x.get().value('event')))))toList()
堆栈跟踪:

GremlinServerError                        Traceback (most recent call last)
<ipython-input-392-602123a0a83a> in <module>()
----> 1 g.V().out().map(lambda: "lambda x: len(x.get().value('event'))").toList()

/usr/local/lib/python3.7/site-packages/gremlin_python/process/traversal.py in toList(self)
     55 
     56     def toList(self):
---> 57         return list(iter(self))
     58 
     59     def toSet(self):

/usr/local/lib/python3.7/site-packages/gremlin_python/process/traversal.py in __next__(self)
     45     def __next__(self):
     46         if self.traversers is None:
---> 47             self.traversal_strategies.apply_strategies(self)
     48         if self.last_traverser is None:
     49             self.last_traverser = next(self.traversers)

/usr/local/lib/python3.7/site-packages/gremlin_python/process/traversal.py in apply_strategies(self, traversal)
    504     def apply_strategies(self, traversal):
    505         for traversal_strategy in self.traversal_strategies:
--> 506             traversal_strategy.apply(traversal)
    507 
    508     def apply_async_strategies(self, traversal):

/usr/local/lib/python3.7/site-packages/gremlin_python/driver/remote_connection.py in apply(self, traversal)
    146     def apply(self, traversal):
    147         if traversal.traversers is None:
--> 148             remote_traversal = self.remote_connection.submit(traversal.bytecode)
    149             traversal.remote_results = remote_traversal
    150             traversal.side_effects = remote_traversal.side_effects

/usr/local/lib/python3.7/site-packages/gremlin_python/driver/driver_remote_connection.py in submit(self, bytecode)
     52     def submit(self, bytecode):
     53         result_set = self._client.submit(bytecode)
---> 54         results = result_set.all().result()
     55         side_effects = RemoteTraversalSideEffects(result_set.request_id, self._client,
     56                                                   result_set.status_attributes)

/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py in result(self, timeout)
    430                 raise CancelledError()
    431             elif self._state == FINISHED:
--> 432                 return self.__get_result()
    433             else:
    434                 raise TimeoutError()

/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py in __get_result(self)
    382     def __get_result(self):
    383         if self._exception:
--> 384             raise self._exception
    385         else:
    386             return self._result

/usr/local/lib/python3.7/site-packages/gremlin_python/driver/resultset.py in cb(f)
     88         def cb(f):
     89             try:
---> 90                 f.result()
     91             except Exception as e:
     92                 future.set_exception(e)

/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py in result(self, timeout)
    423                 raise CancelledError()
    424             elif self._state == FINISHED:
--> 425                 return self.__get_result()
    426 
    427             self._condition.wait(timeout)

/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py in __get_result(self)
    382     def __get_result(self):
    383         if self._exception:
--> 384             raise self._exception
    385         else:
    386             return self._result

/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py in run(self)
     55 
     56         try:
---> 57             result = self.fn(*self.args, **self.kwargs)
     58         except BaseException as exc:
     59             self.future.set_exception(exc)

/usr/local/lib/python3.7/site-packages/gremlin_python/driver/connection.py in _receive(self)
     78             while True:
     79                 data = self._transport.read()
---> 80                 status_code = self._protocol.data_received(data, self._results)
     81                 if status_code != 206:
     82                     break

/usr/local/lib/python3.7/site-packages/gremlin_python/driver/protocol.py in data_received(self, message, results_dict)
    108         else:
    109             del results_dict[request_id]
--> 110             raise GremlinServerError(message["status"])

GremlinServerError: 599: {"requestId":"b8d8ea20-bcab-4350-94f3-47611fac704a","code":"InternalFailureException","detailedMessage":"gremlin-python is not an available GremlinScriptEngine"}```

GremlinServerError回溯(最近一次调用)
在()
---->1 g.V().out().map(lambda:“lambda x:len(x.get().value('event')))”).toList()
/toList(self)中的usr/local/lib/python3.7/site-packages/gremlin_python/process/traversal.py
55
56 def toList(自我):
--->57返回清单(国际热核实验堆(自行))
58
59 def toSet(自):
/usr/local/lib/python3.7/site-packages/gremlin\u python/process/traversal.py in\uuuuuuuuu next\uuuuuu(self)
45定义下一个定义(自身):
46如果self.traversers为无:
--->47自我。遍历策略。应用策略(自我)
48如果self.last_遍历器为无:
49 self.last_遍历器=下一个(self.traversers)
/应用策略中的usr/local/lib/python3.7/site-packages/gremlin\u python/process/traversal.py(self,traversal)
504 def应用策略(自我、遍历):
505对于self.traversal_策略中的traversal_策略:
-->506遍历策略。应用(遍历)
507
508 def应用异步策略(自、遍历):
/应用中的usr/local/lib/python3.7/site-packages/gremlin_python/driver/remote_connection.py(self,遍历)
146 def应用(自、横向):
147如果traversal.traversers为无:
-->148 remote_traversal=self.remote_connection.submit(traversal.bytecode)
149遍历。远程遍历结果=远程遍历
150遍历.副作用=远程遍历.副作用
/提交中的usr/local/lib/python3.7/site-packages/gremlin_python/driver/driver_remote_connection.py(self,字节码)
52 def提交(自身,字节码):
53结果集=self.\u客户端.submit(字节码)
--->54 results=result\u set.all().result()
55副作用=RemoteTraversalSideEffects(结果集、请求id、自身、客户端、,
56结果(设置状态属性)
/usr/local/ceral/python/3.7.3/Frameworks/python.framework/Versions/3.7/lib/python3.7/concurrent/futures//u base.py输入结果(self,超时)
430升高取消错误()
431 elif self.\u state==完成:
-->432返回self.\u获取\u结果()
433其他:
434 raise TimeoutError()
/usr/local/ceral/python/3.7.3/Frameworks/python.framework/Versions/3.7/lib/python3.7/concurrent/futures//u base.py in\u get\u result(self)
382定义获取结果(自身):
383如果自身存在例外情况:
-->384升起自我。\u异常
385其他:
386返回自我。\u结果
/cb(f)中的usr/local/lib/python3.7/site-packages/gremlin_python/driver/resultset.py
88 def cb(f):
89尝试:
--->90 f.结果()
91例外情况e除外:
92未来。设置例外(e)
/usr/local/ceral/python/3.7.3/Frameworks/python.framework/Versions/3.7/lib/python3.7/concurrent/futures//u base.py输入结果(self,超时)
423提升取消错误()
424 elif自身状态==完成:
-->425返回self.\u获取\u结果()
426
427自身条件等待(超时)
/usr/local/ceral/python/3.7.3/Frameworks/python.framework/Versions/3.7/lib/python3.7/concurrent/futures//u base.py in\u get\u result(self)
382定义获取结果(自身):
383如果自身存在例外情况:
-->384升起自我。\u异常
385其他:
386返回自我。\u结果
/运行中的usr/local/ceral/python/3.7.3/Frameworks/python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py(self)
55
56尝试:
--->57结果=self.fn(*self.args,**self.kwargs)
58除作为exc的基本例外情况外:
59.自我未来设定例外(exc)
/usr/local/lib/python3.7/site-packages/gremlin_python/driver/connection.py in_receive(self)
78虽然正确:
79 data=self.\u transport.read()
--->80状态代码=自我协议数据接收(数据、自我结果)
81如果状态代码!=206:
82休息
/接收数据中的usr/local/lib/python3.7/site-packages/gremlin\u python/driver/protocol.py(self、message、results\u dict)
108.其他:
109删除结果目录[请求id]
-->110 raise GRIMLINSERVERERROR(消息[“状态”])
GremlinServerError:599:{“requestId”:“b8d8ea20-bcab-4350-94f3-47611fac704a”,“代码”:“InternalFailureException”,“detailedMessage”:“gremlin python不是可用的GremlInScriptingine”}```

如果Neptune上有gremlin python脚本引擎,我会感到惊讶。事实上,即使使用Gremlin服务器,默认情况下也不会安装Gremlin python,并且只对Gremlin服务器可用

我想说的是,答案是提交类似的:


但总的来说,这样做是否可行还值得怀疑。我认为您将必须弄清楚如何在没有此功能的情况下编写遍历

出于安全原因,Amazon Neptune不允许任何脚本引擎。文档[1]没有专门调用脚本引擎,但它提到Neptune不支持Lambda和groovy脚本


[1]

您是否能够成功地发出一个简单的查询,例如
g.V()
g.V().out().map(lambda: ("it.get().value('name').length()", "gremlin-groovy")).sum().toList()