use of org.apache.metron.integration.UnableToStartException in project metron by apache.
the class FluxTopologyComponent method start.
@Override
public void start() throws UnableToStartException {
try {
stormCluster = new LocalCluster();
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
try (CuratorFramework client = CuratorFrameworkFactory.newClient(getZookeeperConnectString(), retryPolicy)) {
client.start();
String root = "/storm/leader-lock";
Stat exists = client.checkExists().forPath(root);
if (exists == null) {
client.create().creatingParentsIfNeeded().forPath(root);
}
} catch (Exception e) {
LOG.error("Unable to create leaderlock", e);
} finally {
}
} catch (Exception e) {
throw new UnableToStartException("Unable to start flux topology: " + getTopologyLocation(), e);
}
}
use of org.apache.metron.integration.UnableToStartException in project metron by apache.
the class YarnComponent method start.
@Override
public void start() throws UnableToStartException {
conf = new YarnConfiguration();
conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 128);
conf.set("yarn.log.dir", "target");
conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
conf.set(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class.getName());
conf.setBoolean(YarnConfiguration.NODE_LABELS_ENABLED, true);
try {
yarnCluster = new MiniYARNCluster(testName, 1, NUM_NMS, 1, 1, true);
yarnCluster.init(conf);
yarnCluster.start();
waitForNMsToRegister();
URL url = Thread.currentThread().getContextClassLoader().getResource("yarn-site.xml");
if (url == null) {
throw new RuntimeException("Could not find 'yarn-site.xml' dummy file in classpath");
}
Configuration yarnClusterConfig = yarnCluster.getConfig();
yarnClusterConfig.set("yarn.application.classpath", new File(url.getPath()).getParent());
// write the document to a buffer (not directly to the file, as that
// can cause the file being written to get read -which will then fail.
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
yarnClusterConfig.writeXml(bytesOut);
bytesOut.close();
// write the bytes to the file in the classpath
OutputStream os = new FileOutputStream(new File(url.getPath()));
os.write(bytesOut.toByteArray());
os.close();
FileContext fsContext = FileContext.getLocalFSFileContext();
fsContext.delete(new Path(conf.get("yarn.timeline-service.leveldb-timeline-store.path")), true);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
}
} catch (Exception e) {
throw new UnableToStartException("Exception setting up yarn cluster", e);
}
}
Aggregations