gremlin-python 3.3.2


ivaylo frankov <i.fr...@...>
 

Hi All,

I downloaded prebulded 0.3.0 RC from 

https://groups.google.com/forum/#!topic/janusgraph-dev/0ng5lHio4TQ

and I tried to make a connection with python 

I installed gremiln-python 3.3.2 (previously I used 3.2.6 with 0.2.0 Release )

I loaded GraphOfTheGodsFactory.load(graph)
and I tried in gremiln console :  
gremlin> saturn = g.V().has('name', 'saturn').next()
==>v[4096]

After that I tried the same in python:

print("Test")
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
import time


from gremlin_python.process.traversal import T
from gremlin_python.process.traversal import Order
from gremlin_python.process.traversal import Cardinality
from gremlin_python.process.traversal import Column
from gremlin_python.process.traversal import Direction
from gremlin_python.process.traversal import Operator
from gremlin_python.process.traversal import P
from gremlin_python.process.traversal import Pop
from gremlin_python.process.traversal import Scope
from gremlin_python.process.traversal import Barrier

graph = Graph()
g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
print("start")
saturn = g.V().has('name', 'saturn').next()
print("end")

and I received 

/home/ivo/anaconda3/envs/tensorflow/bin/python /home/ivo/PycharmProjects/test2/testp.py
Test
start
Traceback (most recent call last):
  File "/home/ivo/PycharmProjects/test2/testp.py", line 24, in <module>
    saturn = g.V().has('name', 'saturn').next()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 70, in next
    return self.__next__()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 43, in __next__
    self.traversal_strategies.apply_strategies(self)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 346, in apply_strategies
    traversal_strategy.apply(traversal)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/remote_connection.py", line 143, in apply
    remote_traversal = self.remote_connection.submit(traversal.bytecode)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py", line 54, in submit
    results = result_set.all().result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/resultset.py", line 81, in cb
    f.result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/connection.py", line 77, in _receive
    self._protocol.data_received(data, self._results)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/protocol.py", line 71, in data_received
    result_set = results_dict[request_id]
KeyError: None

I checked it is the right Version of Gremlin-Python 3.3.2

Would you mind to tell me how to make it works?

Thank you very much in advance!

Cheers,
Ivo


Florian Hockmann <f...@...>
 

It would be helpful to see the logs on the server side but it is probably caused by mismatches of the GraphSON versions. TinkerPop 3.3.0 introduced GraphSON 3 and used that as the default serializer from then on but JanusGraph doesn't have a GraphSON 3 serializer configured by default (PR #1123 will change this). So you probably just need to add the GraphSON 3 serializer to your gremlin-server.yaml file:

- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}

Alternatively, you could also let Gremlin-Python use GraphSON 2.

Am Donnerstag, 21. Juni 2018 20:16:05 UTC+2 schrieb ivaylo frankov:

Hi All,

I downloaded prebulded 0.3.0 RC from 


and I tried to make a connection with python 

I installed gremiln-python 3.3.2 (previously I used 3.2.6 with 0.2.0 Release )

I loaded GraphOfTheGodsFactory.load(graph)
and I tried in gremiln console :  
gremlin> saturn = g.V().has('name', 'saturn').next()
==>v[4096]

After that I tried the same in python:

print("Test")
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
import time


from gremlin_python.process.traversal import T
from gremlin_python.process.traversal import Order
from gremlin_python.process.traversal import Cardinality
from gremlin_python.process.traversal import Column
from gremlin_python.process.traversal import Direction
from gremlin_python.process.traversal import Operator
from gremlin_python.process.traversal import P
from gremlin_python.process.traversal import Pop
from gremlin_python.process.traversal import Scope
from gremlin_python.process.traversal import Barrier

graph = Graph()
g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
print("start")
saturn = g.V().has('name', 'saturn').next()
print("end")

and I received 

/home/ivo/anaconda3/envs/tensorflow/bin/python /home/ivo/PycharmProjects/test2/testp.py
Test
start
Traceback (most recent call last):
  File "/home/ivo/PycharmProjects/test2/testp.py", line 24, in <module>
    saturn = g.V().has('name', 'saturn').next()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 70, in next
    return self.__next__()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 43, in __next__
    self.traversal_strategies.apply_strategies(self)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 346, in apply_strategies
    traversal_strategy.apply(traversal)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/remote_connection.py", line 143, in apply
    remote_traversal = self.remote_connection.submit(traversal.bytecode)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py", line 54, in submit
    results = result_set.all().result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/resultset.py", line 81, in cb
    f.result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/connection.py", line 77, in _receive
    self._protocol.data_received(data, self._results)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/protocol.py", line 71, in data_received
    result_set = results_dict[request_id]
KeyError: None

I checked it is the right Version of Gremlin-Python 3.3.2

Would you mind to tell me how to make it works?

Thank you very much in advance!

Cheers,
Ivo


ivaylo frankov <i.fr...@...>
 

Thank you Florian!!!
That works!
Only here:
saturn = g.V().hasLabel('person').has('age',gt(30)).order().by('age',decr).toList()
I receive no response.
My Client says that "decr" and "gt" are not recognized.
Can you help me again?
Thank you very much again!

Am Freitag, 22. Juni 2018 08:31:40 UTC+2 schrieb Florian Hockmann:

It would be helpful to see the logs on the server side but it is probably caused by mismatches of the GraphSON versions. TinkerPop 3.3.0 introduced GraphSON 3 and used that as the default serializer from then on but JanusGraph doesn't have a GraphSON 3 serializer configured by default (PR #1123 will change this). So you probably just need to add the GraphSON 3 serializer to your gremlin-server.yaml file:

- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}

Alternatively, you could also let Gremlin-Python use GraphSON 2.

Am Donnerstag, 21. Juni 2018 20:16:05 UTC+2 schrieb ivaylo frankov:
Hi All,

I downloaded prebulded 0.3.0 RC from 


and I tried to make a connection with python 

I installed gremiln-python 3.3.2 (previously I used 3.2.6 with 0.2.0 Release )

I loaded GraphOfTheGodsFactory.load(graph)
and I tried in gremiln console :  
gremlin> saturn = g.V().has('name', 'saturn').next()
==>v[4096]

After that I tried the same in python:

print("Test")
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
import time


from gremlin_python.process.traversal import T
from gremlin_python.process.traversal import Order
from gremlin_python.process.traversal import Cardinality
from gremlin_python.process.traversal import Column
from gremlin_python.process.traversal import Direction
from gremlin_python.process.traversal import Operator
from gremlin_python.process.traversal import P
from gremlin_python.process.traversal import Pop
from gremlin_python.process.traversal import Scope
from gremlin_python.process.traversal import Barrier

graph = Graph()
g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
print("start")
saturn = g.V().has('name', 'saturn').next()
print("end")

and I received 

/home/ivo/anaconda3/envs/tensorflow/bin/python /home/ivo/PycharmProjects/test2/testp.py
Test
start
Traceback (most recent call last):
  File "/home/ivo/PycharmProjects/test2/testp.py", line 24, in <module>
    saturn = g.V().has('name', 'saturn').next()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 70, in next
    return self.__next__()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 43, in __next__
    self.traversal_strategies.apply_strategies(self)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 346, in apply_strategies
    traversal_strategy.apply(traversal)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/remote_connection.py", line 143, in apply
    remote_traversal = self.remote_connection.submit(traversal.bytecode)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py", line 54, in submit
    results = result_set.all().result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/resultset.py", line 81, in cb
    f.result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/connection.py", line 77, in _receive
    self._protocol.data_received(data, self._results)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/protocol.py", line 71, in data_received
    result_set = results_dict[request_id]
KeyError: None

I checked it is the right Version of Gremlin-Python 3.3.2

Would you mind to tell me how to make it works?

Thank you very much in advance!

Cheers,
Ivo


Florian Hockmann <f...@...>
 

gt() is a method of the P class and decr is part of the Order enum. So try it with P.gt() and Order.decr instead or do this first:
statics.load_statics(globals())

You can find more information in the TinkerPop docs for Gremlin-Python.

By the way, next time please ask such questions in the JanusGraph users group as this group is intended for discussions about the development of JanusGraph itself.

Am Freitag, 22. Juni 2018 22:09:30 UTC+2 schrieb ivaylo frankov:

Thank you Florian!!!
That works!
Only here:
saturn = g.V().hasLabel('person').has('age',gt(30)).order().by('age',decr).toList()
I receive no response.
My Client says that "decr" and "gt" are not recognized.
Can you help me again?
Thank you very much again!

Am Freitag, 22. Juni 2018 08:31:40 UTC+2 schrieb Florian Hockmann:
It would be helpful to see the logs on the server side but it is probably caused by mismatches of the GraphSON versions. TinkerPop 3.3.0 introduced GraphSON 3 and used that as the default serializer from then on but JanusGraph doesn't have a GraphSON 3 serializer configured by default (PR #1123 will change this). So you probably just need to add the GraphSON 3 serializer to your gremlin-server.yaml file:

- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}

Alternatively, you could also let Gremlin-Python use GraphSON 2.

Am Donnerstag, 21. Juni 2018 20:16:05 UTC+2 schrieb ivaylo frankov:
Hi All,

I downloaded prebulded 0.3.0 RC from 


and I tried to make a connection with python 

I installed gremiln-python 3.3.2 (previously I used 3.2.6 with 0.2.0 Release )

I loaded GraphOfTheGodsFactory.load(graph)
and I tried in gremiln console :  
gremlin> saturn = g.V().has('name', 'saturn').next()
==>v[4096]

After that I tried the same in python:

print("Test")
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
import time


from gremlin_python.process.traversal import T
from gremlin_python.process.traversal import Order
from gremlin_python.process.traversal import Cardinality
from gremlin_python.process.traversal import Column
from gremlin_python.process.traversal import Direction
from gremlin_python.process.traversal import Operator
from gremlin_python.process.traversal import P
from gremlin_python.process.traversal import Pop
from gremlin_python.process.traversal import Scope
from gremlin_python.process.traversal import Barrier

graph = Graph()
g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
print("start")
saturn = g.V().has('name', 'saturn').next()
print("end")

and I received 

/home/ivo/anaconda3/envs/tensorflow/bin/python /home/ivo/PycharmProjects/test2/testp.py
Test
start
Traceback (most recent call last):
  File "/home/ivo/PycharmProjects/test2/testp.py", line 24, in <module>
    saturn = g.V().has('name', 'saturn').next()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 70, in next
    return self.__next__()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 43, in __next__
    self.traversal_strategies.apply_strategies(self)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 346, in apply_strategies
    traversal_strategy.apply(traversal)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/remote_connection.py", line 143, in apply
    remote_traversal = self.remote_connection.submit(traversal.bytecode)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py", line 54, in submit
    results = result_set.all().result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/resultset.py", line 81, in cb
    f.result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/connection.py", line 77, in _receive
    self._protocol.data_received(data, self._results)
  File "/home/ivo/anaconda3/envs/tensorflow/lib/python3.6/site-packages/gremlin_python/driver/protocol.py", line 71, in data_received
    result_set = results_dict[request_id]
KeyError: None

I checked it is the right Version of Gremlin-Python 3.3.2

Would you mind to tell me how to make it works?

Thank you very much in advance!

Cheers,
Ivo