2
votes

I've problem with janusgraph gremlin-server and Cluster client. Vertices retrieved using Cluster (gremlin-driver 3.2.3/3.2.5) only contains id attribute, label and properties always empty.

This is my client config.

val cluster = Cluster.open("/opt/janusgraph-0.1.1-hadoop2/conf/remote-objects.yaml")

remote-objects.yaml

hosts: [localhost] 
   port: 8182
   serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}

gremlin-server config:

host: localhost
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
  graph: conf/gremlin-server/graph.properties}
plugins:
  - janusgraph.imports
scriptEngines: {
  gremlin-groovy: {
    imports: [java.lang.Math],
    staticImports: [java.lang.Math.PI],
    scripts: [scripts/empty-sample.groovy]}}
serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: {ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
processors:
  - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
  - { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }}
metrics: {
  consoleReporter: {enabled: true, interval: 180000},
  csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
  jmxReporter: {enabled: true},
  slf4jReporter: {enabled: true, interval: 180000},
  gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
  graphiteReporter: {enabled: false, interval: 180000}}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
ssl: {enabled: false}

Remote queries using gremlin-console working fine (remote.yaml and remote-objects.yaml)

Queries using Cluster and remote traversals don't work:

val g = EmptyGraph.instance().traversal().withRemote(DriverRemoteConnection.using(cluster, "g"))

g.V().toList.foreach(v => println(v, "id", v.id(), "label", v.label(), v.properties("name").toList, v.getClass))

Output:

(v[8336],id,8336,label,,List(),class org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex)
(v[12288],id,12288,label,,List(),class org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex)
(v[12304],id,12304,label,,List(),class org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex)
(v[12328],id,12328,label,,List(),class org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex)
(v[12360],id,12360,label,,List(),class org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex)

What I'm doing wrong?

1

1 Answers

4
votes

When working with a remote graph like you've attempted, you will get back ReferenceElements which have minimal information included with them. Unfortunately, there are not a lot of docs on this at the moment (I've opened a ticket to address this), but you can refer to this mailing list thread.

The remote traversals are working fine, but you should be more explicit in what you request. For example, if you want the id, label, and all properties, you could use:

g.V().valueMap(true).toList()