[ 
https://issues.apache.org/jira/browse/TINKERPOP-2188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

stephen mallette closed TINKERPOP-2188.
---------------------------------------
    Resolution: Not A Bug

Took me a while to get to this, but after doing TINKERPOP-2196 I decided to 
test this one thinking it might have been resolved by that, but I noticed that 
this just looks like a configuration problem with the strategy:

{code}
>>> g2 = 
>>> g.withStrategies(PartitionStrategy(partition_key="partition",write_partition="a",
>>>  read_partitions=["a"]))
>>> x = g2.addV('test').property("p1",1).toList()
>>> g.V().valueMap().toList()
[{u'age': [29], u'name': [u'marko']}, {u'age': [27], u'name': [u'vadas']}, 
{u'lang': [u'java'], u'name': [u'lop']}, {u'age': [32], u'name': [u'josh']}, 
{u'lang': [u'java'], u'name': [u'ripple']}, {u'age': [35], u'name': 
[u'peter']}, {u'p1': [1], u'partition': [u'a']}]
>>> g2.V().valueMap().toList()
[{u'p1': [1], u'partition': [u'a']}]
{code}

Note that {{read_partitions}} must be a {{List}} - not a string. If I used a 
string then i got the error you were seeing. The server logs hinted at what the 
problem was. Please reopen if you find that using the {{List}} configuration 
doesn't work (and if it doesn't work in a release, please try on the 
TINKERPOP-2196 branch - which should merge shortly - as it worked there for me)

> PartitionStrategy from Python causes a 599 GremlinServer error
> --------------------------------------------------------------
>
>                 Key: TINKERPOP-2188
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2188
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: python
>    Affects Versions: 3.4.1
>         Environment: Linux client, Python 3, pip install of gremlinpython 
> 3.4.1
>            Reporter: Kelvin R. Lawrence
>            Priority: Minor
>
> Using the code snippet below to any GremlinServer running even an empty 
> TinkerGraph causes GremlinServer to fail with a 599 error. I assume as this 
> is a decoration strategy that the client side Python is generating something 
> invalid. I could not find any coverage for PartitionStrategy in the strategy 
> test cases for the Python client. Maybe I missed them but did not find any. I 
> opened this against 3.4.1 but I have not tried to use this strategy from 
> Python before so not sure if it worked previously.
>  
>  
> {code:java}
>  
> from gremlin_python.driver.driver_remote_connection import 
> DriverRemoteConnection
> from gremlin_python.structure.graph import Graph
> from gremlin_python import statics
> from gremlin_python.process.graph_traversal import __
> from gremlin_python.process.strategies import *
> from gremlin_python.process.traversal import *
> from gremlin_python.process.anonymous_traversal import traversal
> import sys
> endpoint = 'ws://localhost:8182/gremlin'
> graph=Graph()
> connection = DriverRemoteConnection(endpoint,'g')
> g = traversal().withRemote(connection)
> g2 = 
> g.withStrategies(PartitionStrategy(partition_key="partition",write_partition="a",
>  read_partitions="a"))
> try:
> x = g2.addV('test').property("p1",1).toList()
> except:
> print("Exception trying to add a vertex")
> print(sys.exc_info())
> finally:
> connection.close(){code}
> When run the code above will generate this error:
>  
> {code:java}
> Exception trying to add a vertex
> (<class 'gremlin_python.driver.protocol.GremlinServerError'>, 
> GremlinServerError('599: None',), <traceback object at 0x7f723781ff88>)
>  connection.close(){code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to