use of org.apache.gobblin.yarn.event.GetApplicationReportFailureEvent 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, InterruptedException {
this.eventBus.register(this);
if (this.isHelixClusterManaged) {
LOGGER.info("Helix cluster is managed; skipping creation of Helix cluster");
} else {
String clusterName = this.config.getString(GobblinClusterConfigurationKeys.HELIX_CLUSTER_NAME_KEY);
boolean overwriteExistingCluster = ConfigUtils.getBoolean(this.config, GobblinClusterConfigurationKeys.HELIX_CLUSTER_OVERWRITE_KEY, GobblinClusterConfigurationKeys.DEFAULT_HELIX_CLUSTER_OVERWRITE);
LOGGER.info("Creating Helix cluster {} with overwrite: {}", clusterName, overwriteExistingCluster);
HelixUtils.createGobblinHelixCluster(this.config.getString(GobblinClusterConfigurationKeys.ZK_CONNECTION_STRING_KEY), clusterName, overwriteExistingCluster);
LOGGER.info("Created Helix cluster " + clusterName);
}
connectHelixManager();
// Before connect with yarn client, we need to login to get the token
if (ConfigUtils.getBoolean(config, GobblinYarnConfigurationKeys.ENABLE_KEY_MANAGEMENT, false)) {
this.securityManager = Optional.of(buildSecurityManager());
this.securityManager.get().loginAndScheduleTokenRenewal();
}
startYarnClient();
this.applicationId = getReconnectableApplicationId();
if (!this.applicationId.isPresent()) {
disableLiveHelixInstances();
LOGGER.info("No reconnectable application found so submitting a new application");
this.yarnClient = potentialYarnClients.get(this.originalYarnRMAddress);
this.applicationId = Optional.of(setupAndSubmitApplication());
}
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);
addServices();
}
Aggregations