You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/12/07 18:54:58 UTC

[jira] [Commented] (TINKERPOP-1490) Provider a Future based Traversal.async(Function) terminal step

    [ https://issues.apache.org/jira/browse/TINKERPOP-1490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15729581#comment-15729581 ] 

ASF GitHub Bot commented on TINKERPOP-1490:
-------------------------------------------

Github user davebshow commented on the issue:

    https://github.com/apache/tinkerpop/pull/478
  
    Well I implemented this API for gremlin-python. There is one major problem: side effects. Since the current side effect API is designed to be synchronous (calling `run_sync`), it cannot be used inside a coroutine, as  demonstrated by this [test](https://github.com/apache/tinkerpop/blob/54fac5146a5ac067e75f2fbfe135fae2da641c35/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py#L210). This is problematic for a Tornado or Asyncio based driver. I think in the future we should consider the possibility that the `promise()` method return a `AsyncSideEffect` object so the end user can leverage the async techniques with side effects.


> Provider a Future based Traversal.async(Function<Traversal,V>) terminal step
> ----------------------------------------------------------------------------
>
>                 Key: TINKERPOP-1490
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1490
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: language-variant, process
>    Affects Versions: 3.2.2
>            Reporter: Marko A. Rodriguez
>
> [~mbroecheler] had the idea of adding a {{Traversal.async()}} method. This is important for not only avoiding thread locking on a query in Gremlin, but also, it will allow single threaded language variants like Gremlin-JavaScript to use callbacks for processing query results.
> {code}
> Future<List<String>> result = g.V().out().values("name").async(Traversal::toList)
> {code}
> {code}
> Future<List<String>> result = g.V().out().name.async{it.toList()}
> {code}
> {code}
> g.V().out().values('name').async((err,names) => {
>   // I don't know JavaScript, but ...
>   return list(names);
> }) 
> {code}
> ...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)