Github user davebshow commented on the issue:
https://github.com/apache/tinkerpop/pull/478
I put together a quick example of how this can be implemented in
gremlin-python. Obviously the example is incomplete, but hopefully it can help
move the discussion forward:
https://github.com/apache/tinkerpop/commit/aa85a9b5278c55aa28014aa135c8498428295071
These changes result in the following APIs depending on which Python future
is returned by the driver, but the GLV doesn't care as long as it supports
Python's common future API:
- Tornado w/Python 2.7+ returning a `tornado.concurrent.Future`
```python
@gen.coroutine
def go():
vertices = yield g.V().promise(lambda x: x.toList())
assert len(vertices) == 6
count = yield g.V().count().promise(lambda x: x.next())
assert count == 6
loop.run_sync(go)
```
- Asyncio/Tornado with Python 3.5 async/await syntax returning
`asyncio.Future` or `tornado.concurrent.Future`
```python
async def go():
vertices = await g.V().promise(lambda x: x.toList())
assert len(vertices) == 6
count = await g.V().count().promise(lambda x: x.next())
assert count == 6
loop.run_until_complete(go())
```
- Driver with Python 2.7+ that returns `concurrent.futures.Futures` (or
backport)
```python
def go():
vertices = g.V().promise(lambda x: x.toList()).result()
assert len(vertices) == 6
count = g.V().count().promise(lambda x: x.next()).result()
assert count == 6
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---