Search in sources :

Example 1 with JobExecutionInfoServer

use of org.apache.gobblin.rest.JobExecutionInfoServer in project incubator-gobblin by apache.

the class ServiceBasedAppLauncher method addJobExecutionServerAndAdminUI.

private void addJobExecutionServerAndAdminUI(Properties properties) {
    boolean jobExecInfoServerEnabled = Boolean.valueOf(properties.getProperty(ConfigurationKeys.JOB_EXECINFO_SERVER_ENABLED_KEY, Boolean.FALSE.toString()));
    boolean adminUiServerEnabled = Boolean.valueOf(properties.getProperty(ConfigurationKeys.ADMIN_SERVER_ENABLED_KEY, Boolean.FALSE.toString()));
    if (jobExecInfoServerEnabled) {
        LOG.info("Will launch the job execution info server");
        JobExecutionInfoServer executionInfoServer = new JobExecutionInfoServer(properties);
        addService(executionInfoServer);
        if (adminUiServerEnabled) {
            LOG.info("Will launch the admin UI server");
            addService(createAdminServer(properties, executionInfoServer.getAdvertisedServerUri()));
        }
    } else if (adminUiServerEnabled) {
        LOG.warn("Not launching the admin UI because the job execution info server is not enabled");
    }
}
Also used : JobExecutionInfoServer(org.apache.gobblin.rest.JobExecutionInfoServer)

Example 2 with JobExecutionInfoServer

use of org.apache.gobblin.rest.JobExecutionInfoServer in project incubator-gobblin by apache.

the class GobblinYarnAppLauncher method launch.

/**
 * Launch a new Gobblin instance on Yarn.
 *
 * @throws IOException if there's something wrong launching the application
 * @throws YarnException if there's something wrong launching the application
 */
public void launch() throws IOException, YarnException {
    this.eventBus.register(this);
    String clusterName = this.config.getString(GobblinClusterConfigurationKeys.HELIX_CLUSTER_NAME_KEY);
    HelixUtils.createGobblinHelixCluster(this.config.getString(GobblinClusterConfigurationKeys.ZK_CONNECTION_STRING_KEY), clusterName);
    LOGGER.info("Created Helix cluster " + clusterName);
    connectHelixManager();
    startYarnClient();
    this.applicationId = getApplicationId();
    this.applicationStatusMonitor.scheduleAtFixedRate(new Runnable() {

        @Override
        public void run() {
            try {
                eventBus.post(new ApplicationReportArrivalEvent(yarnClient.getApplicationReport(applicationId.get())));
            } catch (YarnException | IOException e) {
                LOGGER.error("Failed to get application report for Gobblin Yarn application " + applicationId.get(), e);
                eventBus.post(new GetApplicationReportFailureEvent(e));
            }
        }
    }, 0, this.appReportIntervalMinutes, TimeUnit.MINUTES);
    List<Service> services = Lists.newArrayList();
    if (this.config.hasPath(GobblinYarnConfigurationKeys.KEYTAB_FILE_PATH)) {
        LOGGER.info("Adding YarnAppSecurityManager since login is keytab based");
        services.add(buildYarnAppSecurityManager());
    }
    if (!this.config.hasPath(GobblinYarnConfigurationKeys.LOG_COPIER_DISABLE_DRIVER_COPY) || !this.config.getBoolean(GobblinYarnConfigurationKeys.LOG_COPIER_DISABLE_DRIVER_COPY)) {
        services.add(buildLogCopier(this.config, new Path(this.sinkLogRootDir, this.applicationName + Path.SEPARATOR + this.applicationId.get().toString()), GobblinClusterUtils.getAppWorkDirPath(this.fs, this.applicationName, this.applicationId.get().toString())));
    }
    if (config.getBoolean(ConfigurationKeys.JOB_EXECINFO_SERVER_ENABLED_KEY)) {
        LOGGER.info("Starting the job execution info server since it is enabled");
        Properties properties = ConfigUtils.configToProperties(config);
        JobExecutionInfoServer executionInfoServer = new JobExecutionInfoServer(properties);
        services.add(executionInfoServer);
        if (config.getBoolean(ConfigurationKeys.ADMIN_SERVER_ENABLED_KEY)) {
            LOGGER.info("Starting the admin UI server since it is enabled");
            services.add(ServiceBasedAppLauncher.createAdminServer(properties, executionInfoServer.getAdvertisedServerUri()));
        }
    } else if (config.getBoolean(ConfigurationKeys.ADMIN_SERVER_ENABLED_KEY)) {
        LOGGER.warn("NOT starting the admin UI because the job execution info server is NOT enabled");
    }
    this.serviceManager = Optional.of(new ServiceManager(services));
    // Start all the services running in the ApplicationMaster
    this.serviceManager.get().startAsync();
}
Also used : Path(org.apache.hadoop.fs.Path) ApplicationReportArrivalEvent(org.apache.gobblin.yarn.event.ApplicationReportArrivalEvent) ServiceManager(com.google.common.util.concurrent.ServiceManager) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) Service(com.google.common.util.concurrent.Service) JobExecutionInfoServer(org.apache.gobblin.rest.JobExecutionInfoServer) Properties(java.util.Properties) GetApplicationReportFailureEvent(org.apache.gobblin.yarn.event.GetApplicationReportFailureEvent)

Aggregations

JobExecutionInfoServer (org.apache.gobblin.rest.JobExecutionInfoServer)2 ListeningExecutorService (com.google.common.util.concurrent.ListeningExecutorService)1 Service (com.google.common.util.concurrent.Service)1 ServiceManager (com.google.common.util.concurrent.ServiceManager)1 Properties (java.util.Properties)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 ApplicationReportArrivalEvent (org.apache.gobblin.yarn.event.ApplicationReportArrivalEvent)1 GetApplicationReportFailureEvent (org.apache.gobblin.yarn.event.GetApplicationReportFailureEvent)1 Path (org.apache.hadoop.fs.Path)1