/** * Run Block Application specified within the conf, on a given graph, * locally, in-memory. * * With a boolean flag, you can switch between LocalBlockRunner and * InternalVertexRunner implementations of local in-memory computation. */ public static <I extends WritableComparable, V extends Writable, E extends Writable> TestGraph<I, V, E> runApp( TestGraph<I, V, E> graph, boolean useFullDigraphTests) throws Exception { if (useFullDigraphTests) { return InternalVertexRunner.runWithInMemoryOutput(graph.getConf(), graph); } else { runApp(graph); return graph; } }
/** * Attempts to run the vertex internally in the current JVM, reading from and * writing to a temporary folder on local disk. Will start its own zookeeper * instance. * * @param conf GiraphClasses specifying which types to use * @param vertexInputData linewise vertex input data * @return linewise output data, or null if job fails * @throws Exception if anything goes wrong */ public static Iterable<String> run( GiraphConfiguration conf, String[] vertexInputData) throws Exception { return run(conf, vertexInputData, null); }
ZookeeperConfig qpConfig = configLocalZooKeeper(zkDir); boolean success = runZooKeeperAndJob(qpConfig, job); if (!success) { return null;
GiraphConstants.CHECKPOINT_DIRECTORY.set(conf, checkpointsDir); runZooKeeperAndJob(configLocalZooKeeper(zkDir), job);
/** * Attempts to run the vertex internally in the current JVM, reading and * writing to an in-memory graph. Will start its own zookeeper * instance. * * @param <I> Vertex ID * @param <V> Vertex Value * @param <E> Edge Value * @param conf GiraphClasses specifying which types to use * @param graph input graph * @return Output graph * @throws Exception if anything goes wrong */ public static <I extends WritableComparable, V extends Writable, E extends Writable> TestGraph<I, V, E> runWithInMemoryOutput( GiraphConfiguration conf, TestGraph<I, V, E> graph) throws Exception { // Prepare temporary folders File tmpDir = FileUtils.createTestDir(conf.getComputationName()); try { return runWithInMemoryOutput(conf, graph, tmpDir, null); } finally { FileUtils.delete(tmpDir); } }
/** * Attempts to run the vertex internally in the current JVM, * reading from an in-memory graph. Will start its own zookeeper * instance. * * @param <I> Vertex ID * @param <V> Vertex Value * @param <E> Edge Value * @param conf GiraphClasses specifying which types to use * @param graph input graph * @throws Exception if anything goes wrong */ public static <I extends WritableComparable, V extends Writable, E extends Writable> void run( GiraphConfiguration conf, TestGraph<I, V, E> graph) throws Exception { // Prepare temporary folders File tmpDir = FileUtils.createTestDir(conf.getComputationName()); try { run(conf, graph, tmpDir, null); } finally { FileUtils.delete(tmpDir); } }
/** * Attempts to run the vertex internally in the current JVM, reading from and * writing to a temporary folder on local disk. Will start its own zookeeper * instance. * * * @param conf GiraphClasses specifying which types to use * @param vertexInputData linewise vertex input data * @param edgeInputData linewise edge input data * @return linewise output data, or null if job fails * @throws Exception if anything goes wrong */ public static Iterable<String> run( GiraphConfiguration conf, String[] vertexInputData, String[] edgeInputData) throws Exception { // Prepare input file, output folder and temporary folders File tmpDir = FileUtils.createTestDir(conf.getComputationName()); try { return run(conf, vertexInputData, edgeInputData, null, tmpDir); } finally { FileUtils.delete(tmpDir); } }
/** * Attempts to run the vertex internally in the current JVM, reading and * writing to an in-memory graph. Will start its own zookeeper * instance. * * @param <I> Vertex ID * @param <V> Vertex Value * @param <E> Edge Value * @param conf GiraphClasses specifying which types to use * @param graph input graph * @param tmpDir file path for storing temporary files. * @param checkpointsDir if set, will use this folder * for storing checkpoints. * @return Output graph * @throws Exception if anything goes wrong */ public static <I extends WritableComparable, V extends Writable, E extends Writable> TestGraph<I, V, E> runWithInMemoryOutput( GiraphConfiguration conf, TestGraph<I, V, E> graph, File tmpDir, String checkpointsDir) throws Exception { conf.setVertexOutputFormatClass(InMemoryVertexOutputFormat.class); InMemoryVertexOutputFormat.initializeOutputGraph(conf); InternalVertexRunner.run(conf, graph, tmpDir, checkpointsDir); return InMemoryVertexOutputFormat.getOutputGraph(); }