I have set up Tinkerpop Gremlin Server 3.2.3 and Tinkerpop Gremlin Console 3.2.3 and added janusgraph 0.1.1 as plugin to both.
I run following code in remote mode which ends up in below-listed exception
:remote connect tinkerpop.server conf/remote.yaml
:> graph = GraphFactory.open('conf/hadoop-graph/hadoop-load.properties')
:> blvp = BulkLoaderVertexProgram.build().writeGraph('conf/connection.properties').create(graph)
:> graph.compute(SparkGraphComputer).program(blvp).submit().get()
Exception
java.lang.IllegalArgumentException: Graph does not support the provided graph computer: SparkGraphComputer
at org.apache.tinkerpop.gremlin.structure.Graph$Exceptions.graphDoesNotSupportProvidedGraphComputer(Graph.java:1140)
at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph.compute(JanusGraphBlueprintsGraph.java:145)
at org.apache.tinkerpop.gremlin.structure.Graph$compute$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at Script4.run(Script4.groovy:1)
at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:619)
at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:448)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
at org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines.eval(ScriptEngines.java:119)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$2(GremlinExecutor.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
The above code works fine in local mode, can anyone please help out what am I missing here.
You need to define the OLAP graph in the Gremlin Server configuration and also add a script binding for the OLAP graph traversal source.
For example in conf/gremlin-server/gremlin-server.yaml
, update the graphs
to something like this:
graphs: {
graph: conf/gremlin-server/janusgraph-cassandra-es-server.properties,
olapgraph: conf/hadoop-graph/read-cassandra.properties
}
Later on in the conf/gremlin-server/gremlin-server.yaml
, the default configuration uses scripts/empty-sample.groovy
to configure the graph traversal source.
scriptEngines: {
gremlin-groovy: {
imports: [java.lang.Math],
staticImports: [java.lang.Math.PI],
scripts: [scripts/empty-sample.groovy]}}
So in scripts/empty.groovy
, add a binding for the OLAP traversal source og
which will use the SparkGraphComputer
:
globals << [g : graph.traversal(), og : olapgraph.traversal().withComputer(org.apache.tinkerpop.gremlin.spark.process.computer.SparkGraphComputer)]
After restarting the Gremlin Server, connect to it with Gremlin Console, and you will find both graphs and graph traversal sources available:
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Configured localhost/127.0.0.1:8182
gremlin> :> graph
==>standardjanusgraph[cassandrathrift:[127.0.0.1]]
gremlin> :> g
==>graphtraversalsource[standardjanusgraph[cassandrathrift:[127.0.0.1]], standard]
gremlin> :> olapgraph
==>hadoopgraph[cassandrainputformat->gryooutputformat]
gremlin> :> og
==>graphtraversalsource[hadoopgraph[cassandrainputformat->gryooutputformat], sparkgraphcomputer]
gremlin> :> og.V().valueMap(true)
==>{label=software, name=[ripple], lang=[java], id=4328}
==>{label=software, name=[lop], lang=[java], id=4240}
==>{label=person, name=[josh], id=8216, age=[32]}
==>{label=person, name=[marko], id=4120, age=[29]}
==>{label=person, name=[vadas], id=4176, age=[27]}
==>{label=person, name=[peter], id=4296, age=[35]}