Skip to content

Instantly share code, notes, and snippets.

@okram
Created March 17, 2014 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okram/9601527 to your computer and use it in GitHub Desktop.
Save okram/9601527 to your computer and use it in GitHub Desktop.
public Future<Graph> submit() {
try {
final FileSystem fs = FileSystem.get(this.hadoopConfiguration);
fs.delete(new Path("output"), true);
final FileSystem local = FileSystem.getLocal(this.hadoopConfiguration);
final Path vertexProgramPath = new Path("tmp/gremlin", UUID.randomUUID().toString());
final ObjectOutputStream os = new ObjectOutputStream(fs.create(vertexProgramPath));
os.writeObject(this.vertexProgram);
os.close();
fs.deleteOnExit(vertexProgramPath);
DistributedCache.addCacheFile(new URI(vertexProgramPath + "#" + VERTEX_PROGRAM), this.hadoopConfiguration);
DistributedCache.createSymlink(this.hadoopConfiguration);
DistributedCache.addArchiveToClassPath(
new Path("/Users/marko/software/tinkerpop/tinkerpop3/giraph-gremlin/target/giraph-gremlin-3.0.0-SNAPSHOT-job.jar"),
this.hadoopConfiguration,
local);
DistributedCache.addArchiveToClassPath(
new Path("/usr/local/giraph-1.0.0/giraph-core/target/giraph-1.0.0-for-hadoop-1.2.1-jar-with-dependencies.jar"),
this.hadoopConfiguration,
local);
DistributedCache.addArchiveToClassPath(
new Path("/Users/marko/software/tinkerpop/tinkerpop3/gremlin/gremlin-core/target/gremlin-core-3.0.0-SNAPSHOT.jar"),
this.hadoopConfiguration,
local);
DistributedCache.addArchiveToClassPath(
new Path("/Users/marko/software/tinkerpop/tinkerpop3/tinkergraph/target/tinkergraph-3.0.0-SNAPSHOT.jar"),
this.hadoopConfiguration,
local);
ToolRunner.run(new GiraphGraphRunner(this.hadoopConfiguration), new String[]{});
} catch (Exception e) {
java.lang.System.out.println(e.getMessage());
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment