Search in sources :

Example 1 with StramWebApp

use of com.datatorrent.stram.webapp.StramWebApp in project apex-core by apache.

the class StreamingAppMasterService method serviceStart.

@Override
protected void serviceStart() throws Exception {
    super.serviceStart();
    if (UserGroupInformation.isSecurityEnabled()) {
        delegationTokenManager.startThreads();
    }
    // write the connect address for containers to DFS
    InetSocketAddress connectAddress = NetUtils.getConnectAddress(this.heartbeatListener.getAddress());
    URI connectUri = RecoverableRpcProxy.toConnectURI(connectAddress);
    FSRecoveryHandler recoveryHandler = new FSRecoveryHandler(dag.assertAppPath(), getConfig());
    recoveryHandler.writeConnectUri(connectUri.toString());
    // start web service
    try {
        org.mortbay.log.Log.setLog(null);
    } catch (Throwable throwable) {
    // SPOI-2687. As part of Pivotal Certification, we need to catch ClassNotFoundException as Pivotal was using
    // Jetty 7 where as other distros are using Jetty 6.
    // LOG.error("can't set the log to null: ", throwable);
    }
    try {
        Configuration config = getConfig();
        if (SecurityUtils.isStramWebSecurityEnabled()) {
            config = new Configuration(config);
            config.set("hadoop.http.filter.initializers", StramWSFilterInitializer.class.getCanonicalName());
        }
        String customSSLConfig = dag.getValue(LogicalPlan.STRAM_HTTP_CUSTOM_CONFIG);
        if (StringUtils.isNotEmpty(customSSLConfig)) {
            config.addResource(new Path(customSSLConfig));
        }
        WebApp webApp = WebApps.$for("stram", StramAppContext.class, appContext, "ws").with(config).start(new StramWebApp(this.dnmgr));
        LOG.info("Started web service at port: " + webApp.port());
        appMasterTrackingUrl = NetUtils.getConnectAddress(webApp.getListenerAddress()).getHostName() + ":" + webApp.port();
        if (ConfigUtils.isSSLEnabled(config)) {
            appMasterTrackingUrl = "https://" + appMasterTrackingUrl;
        }
        LOG.info("Setting tracking URL to: " + appMasterTrackingUrl);
    } catch (Exception e) {
        LOG.error("Webapps failed to start. Ignoring for now:", e);
    }
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) StramWSFilterInitializer(com.datatorrent.stram.security.StramWSFilterInitializer) InetSocketAddress(java.net.InetSocketAddress) StramWebApp(com.datatorrent.stram.webapp.StramWebApp) URI(java.net.URI) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) IOException(java.io.IOException) YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) WebApp(org.apache.hadoop.yarn.webapp.WebApp) StramWebApp(com.datatorrent.stram.webapp.StramWebApp)

Aggregations

StramWSFilterInitializer (com.datatorrent.stram.security.StramWSFilterInitializer)1 StramWebApp (com.datatorrent.stram.webapp.StramWebApp)1 IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1 URI (java.net.URI)1 Configuration (org.apache.hadoop.conf.Configuration)1 Path (org.apache.hadoop.fs.Path)1 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)1 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)1 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)1 WebApp (org.apache.hadoop.yarn.webapp.WebApp)1