[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-06 Thread stephen mallette (JIRA)

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

stephen mallette commented on TINKERPOP-1896:
-

ok - well then i'm going to re-focus this ticket back on figuring out why 
python lambdas seem to be a bust. thanks.

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-06 Thread Branden Moore (JIRA)

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

Branden Moore commented on TINKERPOP-1896:
--

Right now, my work-around for this ticket is to wait to release a new version 
of my tool until after this bug has been fixed.

Retooling the workflow to avoid the TinkerPop version of __ is less appealing 
than holding off on the update.   I am not terribly concerned with finding a 
work-around.   Waiting a few weeks is an option for me.

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-06 Thread stephen mallette (JIRA)

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

stephen mallette commented on TINKERPOP-1896:
-

yep - i agree that what you pose there is a different discussion and if you'd 
like to start some talk about that on the dev list, that would be cool. 

i guess at this point, i'm mostly interested in knowing for purpose of this 
ticket if any workaround is helping you get past this stumbling block. i would 
think that using the full package name for your DSL version of {{__}} should do 
it (as ugly as that is of course) - is that right?

once i know that, i know where to focus my efforts on this ticket - figuring 
out why python lambdas area bust. then i can turn to what we should do about 
naming the DSL version of {{__}}. 

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-06 Thread Branden Moore (JIRA)

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

Branden Moore commented on TINKERPOP-1896:
--

I view the DSLs as extensions to the Gremlin language, rather than a 
replacement of said language.  If a DSL is an extension to the language, than 
from the user of said extended language, they would expect the existing 
language constructs to continue to exist.   Do you consider '__' to be part of 
the language of Gremlin?   Given how pervasive it is, I certainly would 
consider it part of the language.

Should all DSLs tell their users to avoid using '__', but rather some 
DSL-specific key?   Also, what happens when a user of the DSL (especially with 
GroovyGremlin) forgets to always start anonymous traversals with the DSL's 
version of __, and just allows the static import to fire?  Well, it would get 
the non-DSL version of __, I believe, which will cause much confusion.

 

This discussion is now well off-base now from where this ticket started.  
Perhaps we should move conversation to the mailing list instead?

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-06 Thread stephen mallette (JIRA)

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

stephen mallette commented on TINKERPOP-1896:
-

when you say, "GremlinGroovy does not work with server-side DSLs" - does it 
work if you directly reference your anonymous traversal class by its full 
package name? if so, then lambdas work as they should and perhaps we could add 
an option to the DSL generator in Java to allow renaming of the anonymous class 
which would let you import it more directly without conflict.



> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-05 Thread Branden Moore (JIRA)

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

Branden Moore commented on TINKERPOP-1896:
--

> Anyway, If a traversal has to use a lambda it should make uniform use of a 
> single scripting language.

I agree completely...  However, it is your suggested work-around to this issue 
that leads me down the path of needing to use multiple script engines.   
GremlinGroovy does not work with server-side DSLs, and python-lambdas do not 
work in all cases (this issue).    So I am currently back to no work-around for 
this issue.

 

The entire reason I'm attempting to use a lambda is because Python Dictionaries 
are not hashable, and thus cannot be used as keys to another dictionary.   If 
there is an alternate way to convert, server-side, a Map to something constant, 
perhaps a string?

    What I'm wanting to do is essentially:
{code:java}
g.E().hasLabel('mylabel').match(
__.as('x').outV().label().as('from'),
__.as('x').inV().label().as('to')
).select('from', 'to').groupCount(){code}
 

 

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-05 Thread stephen mallette (JIRA)

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

stephen mallette commented on TINKERPOP-1896:
-

> What is the expected behavior when multiple lambdas exist in a traversal, and 
> they specify different engines? 

i don't think the system was designed to handle that. i would fully expect you 
to get a weird unexplainable error as I doubt that was handled gracefully. we 
should probably look into that and create an issue to do some proper validation 
- if you have time to investigate what happens with that and create an issue as 
needed we'd appreciated it. 

Anyway, If a traversal has to use a lambda it should make uniform use of a 
single scripting language.

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-05 Thread Branden Moore (JIRA)

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

Branden Moore commented on TINKERPOP-1896:
--

That makes a certain amount of sense.  What is the expected behavior when 
multiple lambdas exist in a traversal, and they specify different engines?  Or 
does Groovy trump all others, with the expectation that the Translator step 
will translate a python-lambda to a groovy-lambda?

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-05 Thread stephen mallette (JIRA)

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

stephen mallette commented on TINKERPOP-1896:
-

cool - at least the groovy lambda works. there's been some competing issues 
with lambdas and i'm struggling to keep them all straight. thanks for 
confirming that.

when you add a lambda with the GLV, the traversal gets constructed through the 
scriptengine language that you choose to write the lambda. If you send Groovy, 
the {{GremlinGroovyScriptEngine}} puts the bytecode through a {{Translator}} 
which converts it to a Groovy script which evals to a {{Traversal}} that is 
then iterated out for the result on the server.

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-05 Thread Branden Moore (JIRA)

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

Branden Moore commented on TINKERPOP-1896:
--

I can confirm that the groovy lambda works without DSL involvement.

 

I am the one with the server-side Java DSL.   This does appear to be the same 
issue I was having with the Gremlin-Groovy ScriptEngine.    I just wouldn't 
have expected that using a 'gremlin-groovy' lambda would cause my entire 
traversal to be executed via 'GremlinGroovyScriptEngine'.

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-05 Thread stephen mallette (JIRA)

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

stephen mallette commented on TINKERPOP-1896:
-

Sorry, but do you mind backing up a bit? Can you first confirm if the "groovy" 
lambda works for you without a DSL involved?

If it does work, then I think you need to clarify this a bit:

> it appears that my anonymous traversal source has been reset from my DSL's 
> anonymous traversal source back to the default 
> org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal,

Anonymous traversals are not spawned from {{DefaultGraphTraversal}} - they are 
spawned from the {{__}} class, so i don't completely follow what's happening to 
you. I also don't follow where you are seeing this error. You have a Python DSL 
that is misbehaving? or was this related to a server side Java DSL (I seem to 
recall someone doing that recently and i can't recall if it was you or not)?



> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-05 Thread Branden Moore (JIRA)

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

Branden Moore commented on TINKERPOP-1896:
--

Thanks Stephen,

  If I take my actual targeted traversal, and use a groovy-based lambda, all of 
a sudden, it appears that my anonymous traversal source has been reset from my 
DSL's anonymous traversal source back to the default 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal, 
and so my custom steps are no longer usable.

  How does changing which engine executes the lambda affect the overall script 
engine?  What would be the expected outcome if a single traversal had multiple 
lambdas, using different target-languages?

 

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-03-01 Thread stephen mallette (JIRA)

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

stephen mallette commented on TINKERPOP-1896:
-

There is something really foul with the {{GremlinJythonScriptEngine}} if I 
write the lambda with "groovy" so that it processes with that engine, then all 
is good. I'd say that using groovy for the lambda would be the current 
workaround. 

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in 

[jira] [Commented] (TINKERPOP-1896) gremlin-python lambdas error when working on Maps

2018-02-20 Thread stephen mallette (JIRA)

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

stephen mallette commented on TINKERPOP-1896:
-

The problem doesn't seem to be with {{Map}} coming out of the preceding step:

{code}
>>> g.V().out().groupCount().map(lambda: "lambda x: type(x)").next()
{u'@type': u'g:Class', u'@value': 
u'org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_Traverser'}
>>> g.V().out().groupCount().map(lambda: "lambda x: type(x.get())").next()
{u'@type': u'g:Class', u'@value': u'java.util.HashMap'}
{code}

It's something else...

> gremlin-python lambdas error when working on Maps
> -
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
>  Issue Type: Bug
>  Components: python
>Affects Versions: 3.3.1
>Reporter: Branden Moore
>Priority: Major
>
> Gremlin-python lambdas throw an error on the server when the preceding step 
> produces maps.
> {code}
> Traceback (most recent call last):
>   File "foo.py", line 15, in 
>     print g.V().has('name').match(__.as_('x').label().as_('lbl'), 
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x: 
> type(x)").toList()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 52, in toList
>     return list(iter(self))
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 70, in next
>     return self.__next__()
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 43, in __next__
>     self.traversal_strategies.apply_strategies(self)
>   File 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
>  line 352, in apply_strategies
>     traversal_strategy.apply(traversal)
>   File 
> "/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 
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
>  line 54, in submit
>     results = result_set.all().result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 462, in result
>     return self.__get_result()
>   File 
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 
> 414, in __get_result
>     raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type 
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute 
> 'as_' in