本文整理汇总了Java中org.apache.giraph.conf.GiraphConfiguration.set方法的典型用法代码示例。如果您正苦于以下问题:Java GiraphConfiguration.set方法的具体用法?Java GiraphConfiguration.set怎么用?Java GiraphConfiguration.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.giraph.conf.GiraphConfiguration
的用法示例。
在下文中一共展示了GiraphConfiguration.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetsCalled
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void testGetsCalled() throws Exception {
assertEquals(0, Obs.postApp);
String[] graph = new String[] { "1", "2", "3" };
String klasses[] = new String[] {
Obs.class.getName(),
Obs.class.getName()
};
GiraphConfiguration conf = new GiraphConfiguration();
conf.set(GiraphConstants.MASTER_OBSERVER_CLASSES.getKey(),
arrayToString(klasses));
conf.setComputationClass(SimpleComputation.class);
conf.setOutEdgesClass(ByteArrayEdges.class);
conf.setVertexInputFormatClass(InputFormat.class);
InternalVertexRunner.run(conf, graph);
assertEquals(2, Obs.preApp);
// 3 supersteps + 1 input superstep * 2 observers = 8 callbacks
assertEquals(8, Obs.preSuperstep);
assertEquals(8, Obs.postSuperstep);
assertEquals(2, Obs.postApp);
}
示例2: getEmptyDb
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void getEmptyDb() throws Exception {
Iterable<String> results;
Iterator<String> result;
GiraphConfiguration conf = new GiraphConfiguration();
GIRAPH_GORA_DATASTORE_CLASS.
set(conf, "org.apache.gora.memory.store.MemStore");
GIRAPH_GORA_KEYS_FACTORY_CLASS.
set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
GIRAPH_GORA_PERSISTENT_CLASS.
set(conf,"org.apache.giraph.io.gora.generated.GVertex");
GIRAPH_GORA_START_KEY.set(conf,"1");
GIRAPH_GORA_END_KEY.set(conf,"10");
conf.set("io.serializations",
"org.apache.hadoop.io.serializer.WritableSerialization," +
"org.apache.hadoop.io.serializer.JavaSerialization");
conf.setComputationClass(EmptyComputation.class);
conf.setVertexInputFormatClass(GoraTestVertexInputFormat.class);
results = InternalVertexRunner.run(conf, new String[0], new String[0]);
Assert.assertNotNull(results);
result = results.iterator();
Assert.assertFalse(result.hasNext());
}
示例3: getEmptyDb
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void getEmptyDb() throws Exception {
Iterable<String> results;
Iterator<String> result;
GiraphConfiguration conf = new GiraphConfiguration();
GIRAPH_GORA_DATASTORE_CLASS.
set(conf, "org.apache.gora.memory.store.MemStore");
GIRAPH_GORA_KEYS_FACTORY_CLASS.
set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
GIRAPH_GORA_PERSISTENT_CLASS.
set(conf,"org.apache.giraph.io.gora.generated.GEdge");
GIRAPH_GORA_START_KEY.set(conf,"1");
GIRAPH_GORA_END_KEY.set(conf,"3");
conf.set("io.serializations",
"org.apache.hadoop.io.serializer.WritableSerialization," +
"org.apache.hadoop.io.serializer.JavaSerialization");
conf.setComputationClass(EmptyComputation.class);
conf.setEdgeInputFormatClass(GoraGEdgeEdgeInputFormat.class);
results = InternalVertexRunner.run(conf, new String[0], new String[0]);
Assert.assertNotNull(results);
result = results.iterator();
Assert.assertFalse(result.hasNext());
}
示例4: testGetsCalled
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void testGetsCalled() throws Exception {
assertEquals(0, Obs.postApp);
String[] graph = new String[] { "1", "2", "3" };
String klasses[] = new String[] {
Obs.class.getName(),
Obs.class.getName()
};
GiraphConfiguration conf = new GiraphConfiguration();
conf.set(GiraphConstants.MASTER_OBSERVER_CLASSES.getKey(),
arrayToString(klasses));
conf.setVertexClass(NoOpVertex.class);
conf.setOutEdgesClass(ByteArrayEdges.class);
conf.setVertexInputFormatClass(IntNullNullTextInputFormat.class);
InternalVertexRunner.run(conf, graph);
assertEquals(2, Obs.preApp);
// 3 supersteps + 1 input superstep * 2 observers = 8 callbacks
assertEquals(8, Obs.preSuperstep);
assertEquals(8, Obs.postSuperstep);
assertEquals(2, Obs.postApp);
}
示例5: getConf
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
public GiraphConfiguration getConf() {
GiraphConfiguration conf = new GiraphConfiguration();
conf.setMasterComputeClass(LouvainMasterCompute.class);
conf.setComputationClass(LouvainComputation.class);
conf.setVertexOutputFormatClass(InMemoryVertexOutputFormat.class);
System.setProperty("giraph.useSuperstepCounters", "false");
conf.set("actual.Q.aggregators", "1");
conf.set("minimum.progress", "2000");
conf.set("progress.tries", "1");
conf.set("mapred.output.dir", "tmp/giraph_0");
return conf;
}
示例6: getConf
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
public GiraphConfiguration getConf() {
GiraphConfiguration conf = new GiraphConfiguration();
conf.setMasterComputeClass(HBSEMasterCompute.class);
conf.setComputationClass(HBSEComputation.class);
conf.setVertexOutputFormatClass(InMemoryVertexOutputFormat.class);
conf.set(HBSEConfigurationConstants.BETWEENNESS_OUTPUT_DIR, "tmp/output");
conf.set(HBSEConfigurationConstants.BETWEENNESS_SET_STABILITY, "1");
conf.set(HBSEConfigurationConstants.BETWEENNESS_SET_MAX_SIZE, "10");
conf.set(HBSEConfigurationConstants.BETWEENNESS_SET_STABILITY_COUNTER, "3");
conf.set(HBSEConfigurationConstants.PIVOT_BATCH_SIZE, "2");
conf.set(HBSEConfigurationConstants.TOTAL_PIVOT_COUNT, "6");
return conf;
}
示例7: testTwoCriticalPointGraph
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void testTwoCriticalPointGraph() throws Exception {
GiraphConfiguration conf = getConf();
conf.set(HBSEConfigurationConstants.TOTAL_PIVOT_COUNT, "10");
TestGraph<Text, VertexData, Text> input = getTwoCriticalPointGraph(conf);
InMemoryVertexOutputFormat.initializeOutputGraph(conf);
InternalVertexRunner.run(conf, input);
TestGraph<Text, VertexData, Text> output = InMemoryVertexOutputFormat.getOutputGraph();
assertEquals(16, output.getVertices().size());
assertTrue(output.getVertex(new Text("1")).getValue().getApproxBetweenness() >= 0.0);
assertTrue(output.getVertex(new Text("9")).getValue().getApproxBetweenness() >= 0.0);
assertEquals(output.getVertex(new Text("2")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("3")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("4")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("5")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("6")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("7")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("8")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("10")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("11")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("12")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("13")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("14")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("15")).getValue().getApproxBetweenness(), 0.0, 0.0);
assertEquals(output.getVertex(new Text("16")).getValue().getApproxBetweenness(), 0.0, 0.0);
}
示例8: setUp
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Before
public void setUp() throws IOException, InterruptedException {
rr = mock(RecordReader.class);
GiraphConfiguration giraphConf = new GiraphConfiguration();
giraphConf.setComputationClass(BasicComputation.class);
giraphConf.set(DGALongEdgeValueInputFormat.LINE_TOKENIZE_VALUE, ",");
conf = new ImmutableClassesGiraphConfiguration<Text, Text, Text>(giraphConf);
tac = mock(TaskAttemptContext.class);
when(tac.getConfiguration()).thenReturn(conf);
}
示例9: setupYarnConfiguration
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* Set up the GiraphConfiguration settings we need to run a no-op Giraph
* job on a MiniYARNCluster as an integration test. Some YARN-specific
* flags are set inside GiraphYarnClient and won't need to be set here.
*/
private void setupYarnConfiguration() throws IOException {
conf = new GiraphConfiguration();
conf.setWorkerConfiguration(1, 1, 100.0f);
conf.setMaxMasterSuperstepWaitMsecs(30 * 1000);
conf.setEventWaitMsecs(3 * 1000);
conf.setYarnLibJars(""); // no need
conf.setYarnTaskHeapMb(256); // small since no work to be done
conf.setComputationClass(DummyYarnComputation.class);
conf.setVertexInputFormatClass(IntIntNullTextInputFormat.class);
conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);
conf.setNumComputeThreads(1);
conf.setMaxTaskAttempts(1);
conf.setNumInputSplitsThreads(1);
// Giraph on YARN only ever things its running in "non-local" mode
conf.setLocalTestMode(false);
// this has to happen here before we populate the conf with the temp dirs
setupTempDirectories();
conf.set(OUTDIR, new Path(outputDir.getAbsolutePath()).toString());
GiraphFileInputFormat.addVertexInputPath(conf, new Path(inputDir.getAbsolutePath()));
// hand off the ZK info we just created to our no-op job
GiraphConstants.ZOOKEEPER_SERVERLIST_POLL_MSECS.set(conf, 500);
conf.setZooKeeperConfiguration(zkList);
conf.set(GiraphConstants.ZOOKEEPER_DIR, zkDir.getAbsolutePath());
GiraphConstants.ZOOKEEPER_MANAGER_DIRECTORY.set(conf, zkMgrDir.getAbsolutePath());
// without this, our "real" client won't connect w/"fake" YARN cluster
conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_FIXED_PORTS, true);
}
示例10: setupYarnConfiguration
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* Set up the GiraphConfiguration settings we need to run a no-op Giraph
* job on a MiniYARNCluster as an integration test. Some YARN-specific
* flags are set inside GiraphYarnClient and won't need to be set here.
*/
private void setupYarnConfiguration() throws IOException {
conf = new GiraphConfiguration();
conf.setWorkerConfiguration(1, 1, 100.0f);
conf.setMaxMasterSuperstepWaitMsecs(30 * 1000);
conf.setEventWaitMsecs(3 * 1000);
conf.setYarnLibJars(""); // no need
conf.setYarnTaskHeapMb(256); // small since no work to be done
conf.setVertexClass(DummyYarnVertex.class);
conf.setVertexInputFormatClass(IntIntNullTextInputFormat.class);
conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);
conf.setNumComputeThreads(1);
conf.setMaxTaskAttempts(1);
conf.setNumInputSplitsThreads(1);
// Giraph on YARN only ever things its running in "non-local" mode
conf.setLocalTestMode(false);
// this has to happen here before we populate the conf with the temp dirs
setupTempDirectories();
conf.set(OUTDIR, new Path(outputDir.getAbsolutePath()).toString());
GiraphFileInputFormat.addVertexInputPath(conf, new Path(inputDir.getAbsolutePath()));
// hand off the ZK info we just created to our no-op job
GiraphConstants.ZOOKEEPER_SERVERLIST_POLL_MSECS.set(conf, 500);
conf.setZooKeeperConfiguration(zkList);
conf.set(GiraphConstants.ZOOKEEPER_DIR, zkDir.getAbsolutePath());
GiraphConstants.ZOOKEEPER_MANAGER_DIRECTORY.set(conf, zkMgrDir.getAbsolutePath());
// without this, our "real" client won't connect w/"fake" YARN cluster
conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_FIXED_PORTS, true);
}
示例11: getWritingDb
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void getWritingDb() throws Exception {
Iterable<String> results;
GiraphConfiguration conf = new GiraphConfiguration();
GIRAPH_GORA_DATASTORE_CLASS.
set(conf, "org.apache.gora.memory.store.MemStore");
GIRAPH_GORA_KEYS_FACTORY_CLASS.
set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
GIRAPH_GORA_PERSISTENT_CLASS.
set(conf,"org.apache.giraph.io.gora.generated.GVertex");
GIRAPH_GORA_START_KEY.set(conf,"1");
GIRAPH_GORA_END_KEY.set(conf,"10");
GIRAPH_GORA_OUTPUT_DATASTORE_CLASS.
set(conf, "org.apache.gora.memory.store.MemStore");
GIRAPH_GORA_OUTPUT_KEY_CLASS.set(conf, "java.lang.String");
GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS.
set(conf, "org.apache.giraph.io.gora.generated.GVertex");
conf.set("io.serializations",
"org.apache.hadoop.io.serializer.WritableSerialization," +
"org.apache.hadoop.io.serializer.JavaSerialization");
conf.setComputationClass(EmptyComputation.class);
conf.setVertexInputFormatClass(GoraTestVertexInputFormat.class);
// Parameters for output
GIRAPH_GORA_OUTPUT_DATASTORE_CLASS.
set(conf, "org.apache.gora.memory.store.MemStore");
GIRAPH_GORA_OUTPUT_KEY_CLASS.set(conf, "java.lang.String");
GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS.
set(conf,"org.apache.giraph.io.gora.generated.GVertex");
conf.setVertexOutputFormatClass(GoraTestVertexOutputFormat.class);
results = InternalVertexRunner.run(conf, new String[0], new String[0]);
Assert.assertNotNull(results);
}
示例12: getTestDb
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void getTestDb() throws Exception {
Iterable<String> results;
GiraphConfiguration conf = new GiraphConfiguration();
GIRAPH_GORA_DATASTORE_CLASS.
set(conf, "org.apache.gora.memory.store.MemStore");
GIRAPH_GORA_KEYS_FACTORY_CLASS.
set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
GIRAPH_GORA_PERSISTENT_CLASS.
set(conf,"org.apache.giraph.io.gora.generated.GEdge");
GIRAPH_GORA_START_KEY.set(conf,"1");
GIRAPH_GORA_END_KEY.set(conf,"4");
conf.set("io.serializations",
"org.apache.hadoop.io.serializer.WritableSerialization," +
"org.apache.hadoop.io.serializer.JavaSerialization");
conf.setComputationClass(EmptyComputation.class);
conf.setEdgeInputFormatClass(GoraTestEdgeInputFormat.class);
conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);
results = InternalVertexRunner.run(conf, new String[0], new String[0]);
Assert.assertNotNull(results);
Assert.assertEquals(3, ((ArrayList<?>)results).size());
if (results instanceof Collection<?>
& (((Collection<?>)results).size() == 2)) {
Assert.assertEquals("33\t0.0",
((ArrayList<?>)results).get(0).toString());
Assert.assertEquals("22\t0.0",
((ArrayList<?>)results).get(1).toString());
Assert.assertEquals("11\t0.0",
((ArrayList<?>)results).get(2).toString());
}
}
示例13: getWritingDb
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
@Test
public void getWritingDb() throws Exception {
Iterable<String> results;
GiraphConfiguration conf = new GiraphConfiguration();
// Parameters for input
GIRAPH_GORA_DATASTORE_CLASS.
set(conf, "org.apache.gora.memory.store.MemStore");
GIRAPH_GORA_KEYS_FACTORY_CLASS.
set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
GIRAPH_GORA_PERSISTENT_CLASS.
set(conf,"org.apache.giraph.io.gora.generated.GEdge");
GIRAPH_GORA_START_KEY.set(conf,"1");
GIRAPH_GORA_END_KEY.set(conf,"4");
conf.set("io.serializations",
"org.apache.hadoop.io.serializer.WritableSerialization," +
"org.apache.hadoop.io.serializer.JavaSerialization");
conf.setComputationClass(EmptyComputation.class);
conf.setEdgeInputFormatClass(GoraTestEdgeInputFormat.class);
// Parameters for output
GIRAPH_GORA_OUTPUT_DATASTORE_CLASS.
set(conf, "org.apache.gora.memory.store.MemStore");
GIRAPH_GORA_OUTPUT_KEY_CLASS.set(conf, "java.lang.String");
GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS.
set(conf,"org.apache.giraph.io.gora.generated.GEdge");
conf.setEdgeOutputFormatClass(GoraTestEdgeOutputFormat.class);
results = InternalVertexRunner.run(conf, new String[0], new String[0]);
Assert.assertNotNull(results);
}
示例14: run
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* 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 checkpointsDir if set, will use this folder
* for storing checkpoints.
* @param tmpDir file path for storing temporary files.
* @return linewise output data, or null if job fails
* @throws Exception if anything goes wrong
*/
public static Iterable<String> run(
GiraphConfiguration conf,
String checkpointsDir,
File tmpDir) throws Exception {
String ns = conf.get(HBaseGraphConfiguration.Keys.GRAPH_NAMESPACE);
String prefix = conf.get(HBaseGraphConfiguration.Keys.GRAPH_TABLE_PREFIX);
String tablePrefix = (ns != null ? ns + TableName.NAMESPACE_DELIM : "") + (prefix != null ? prefix : "");
conf.set(Constants.EDGE_INPUT_TABLE, tablePrefix + Constants.EDGES);
conf.set(Constants.VERTEX_INPUT_TABLE, tablePrefix + Constants.VERTICES);
File outputDir = FileUtils.createTempDir(tmpDir, "output");
File zkDir = FileUtils.createTempDir(tmpDir, "_bspZooKeeper");
File zkMgrDir = FileUtils.createTempDir(tmpDir, "_defaultZkManagerDir");
conf.setWorkerConfiguration(1, 1, 100.0f);
GiraphConstants.SPLIT_MASTER_WORKER.set(conf, false);
GiraphConstants.LOCAL_TEST_MODE.set(conf, true);
conf.set(GiraphConstants.ZOOKEEPER_DIR, zkDir.toString());
GiraphConstants.ZOOKEEPER_MANAGER_DIRECTORY.set(conf,
zkMgrDir.toString());
if (checkpointsDir == null) {
checkpointsDir = FileUtils.createTempDir(
tmpDir, "_checkpoints").toString();
}
GiraphConstants.CHECKPOINT_DIRECTORY.set(conf, checkpointsDir);
// Create and configure the job to run the vertex
GiraphJob job = new GiraphJob(conf, conf.getComputationName());
Job internalJob = job.getInternalJob();
//FileOutputFormatUtil.setOutputPath(job.getInternalJob(),
// new Path(outputDir.toString()));
internalJob.getConfiguration().set("mapred.output.dir", outputDir.toString());
// Configure a local zookeeper instance
ZookeeperConfig qpConfig = configLocalZooKeeper(zkDir);
boolean success = runZooKeeperAndJob(qpConfig, job);
if (!success) {
return null;
}
File outFile = new File(outputDir, "part-m-00000");
if (conf.hasVertexOutputFormat() && outFile.canRead()) {
return Files.readLines(outFile, Charsets.UTF_8);
} else {
return ImmutableList.of();
}
}
示例15: run
import org.apache.giraph.conf.GiraphConfiguration; //导入方法依赖的package包/类
/**
* 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 iterable output data
* @throws Exception if anything goes wrong
*/
public static <I extends WritableComparable,
V extends Writable,
E extends Writable> TestGraph<I, V, E> run(
GiraphConfiguration conf,
TestGraph<I, V, E> graph) throws Exception {
File tmpDir = null;
try {
// Prepare temporary folders
tmpDir = FileUtils.createTestDir(conf.getComputationName());
File zkDir = FileUtils.createTempDir(tmpDir, "_bspZooKeeper");
File zkMgrDir = FileUtils.createTempDir(tmpDir, "_defaultZkManagerDir");
File checkpointsDir = FileUtils.createTempDir(tmpDir, "_checkpoints");
conf.setVertexInputFormatClass(InMemoryVertexInputFormat.class);
// Create and configure the job to run the vertex
GiraphJob job = new GiraphJob(conf, conf.getComputationName());
InMemoryVertexInputFormat.setGraph(graph);
conf.setWorkerConfiguration(1, 1, 100.0f);
GiraphConstants.SPLIT_MASTER_WORKER.set(conf, false);
GiraphConstants.LOCAL_TEST_MODE.set(conf, true);
conf.set(GiraphConstants.ZOOKEEPER_LIST, "localhost:" +
String.valueOf(LOCAL_ZOOKEEPER_PORT));
conf.set(GiraphConstants.ZOOKEEPER_DIR, zkDir.toString());
GiraphConstants.ZOOKEEPER_MANAGER_DIRECTORY.set(conf,
zkMgrDir.toString());
GiraphConstants.CHECKPOINT_DIRECTORY.set(conf, checkpointsDir.toString());
// Configure a local zookeeper instance
Properties zkProperties = configLocalZooKeeper(zkDir);
QuorumPeerConfig qpConfig = new QuorumPeerConfig();
qpConfig.parseProperties(zkProperties);
// Create and run the zookeeper instance
final InternalZooKeeper zookeeper = new InternalZooKeeper();
final ServerConfig zkConfig = new ServerConfig();
zkConfig.readFrom(qpConfig);
ExecutorService executorService = Executors.newSingleThreadExecutor();
executorService.execute(new Runnable() {
@Override
public void run() {
try {
zookeeper.runFromConfig(zkConfig);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
try {
job.run(true);
} finally {
executorService.shutdown();
zookeeper.end();
}
return graph;
} finally {
FileUtils.delete(tmpDir);
}
}