package org.example.gdb;
import org.apache.commons.configuration2.Configuration;
...
import static org.apache.tinkerpop.gremlin.hadoop.Constants.GREMLIN_HADOOP_OUTPUT_LOCATION;
import java.lang.Long;
public class JGGremlinSpark {
public static void main(String[] args) throws Exception {
Configuration sparkGraphConfiguration = getSparkGraphConfig();
sparkGraphConfiguration.setProperty(Constants.GREMLIN_SPARK_GRAPH_STORAGE_LEVEL, "MEMORY_AND_DISK");
sparkGraphConfiguration.setProperty(GREMLIN_HADOOP_GRAPH_WRITER, GraphSONOutputFormat.class.getCanonicalName());
sparkGraphConfiguration.setProperty(GREMLIN_HADOOP_OUTPUT_LOCATION, "/home/hadoop/jgspark_test/hadoop_output");
sparkGraphConfiguration.setProperty(SparkLauncher.EXECUTOR_MEMORY, "1g");
Graph graph = GraphFactory.open(sparkGraphConfiguration);
long startTime = System.currentTimeMillis();
GraphTraversalSource g = graph.traversal().withComputer(SparkGraphComputer.class);
final Long vCount = g.V().count().next();
final Long eCount = g.E().count().next();
System.out.println("V count = " + vCount);
System.out.println("E count = " + eCount);
long duration = (System.currentTimeMillis() - startTime) / 1000;
System.out.println("Finished JGGremlinSpark test - elapsed time = " + duration + " seconds.");
}
}
package org.example.gdb;
import org.apache.commons.configuration2.Configuration;
...
import static org.apache.tinkerpop.gremlin.hadoop.Constants.GREMLIN_HADOOP_OUTPUT_LOCATION;
import java.lang.Long;
public class JGGremlinSpark {
public static void main(String[] args) throws Exception {
Configuration sparkGraphConfiguration = getSparkGraphConfig();
sparkGraphConfiguration.setProperty(Constants.GREMLIN_SPARK_GRAPH_STORAGE_LEVEL, "MEMORY_AND_DISK");
sparkGraphConfiguration.setProperty(GREMLIN_HADOOP_GRAPH_WRITER, GraphSONOutputFormat.class.getCanonicalName());
sparkGraphConfiguration.setProperty(GREMLIN_HADOOP_OUTPUT_LOCATION, "/home/hadoop/jgspark_test/hadoop_output");
sparkGraphConfiguration.setProperty(SparkLauncher.EXECUTOR_MEMORY, "1g");
Graph graph = GraphFactory.open(sparkGraphConfiguration);
long startTime = System.currentTimeMillis();
GraphTraversalSource g = graph.traversal().withComputer(SparkGraphComputer.class);
final Long vCount = g.V().count().next();
final Long eCount = g.E().count().next();
System.out.println("V count = " + vCount);
System.out.println("E count = " + eCount);
long duration = (System.currentTimeMillis() - startTime) / 1000;
System.out.println("Finished JGGremlinSpark test - elapsed time = " + duration + " seconds.");
}
}