@Override public void close() { if (!sharedYarnClient) { yarnClient.stop(); } }
protected NMClient createAndStartNodeManagerClient(YarnConfiguration yarnConfiguration) { // create the client to communicate with the node managers NMClient nodeManagerClient = NMClient.createNMClient(); nodeManagerClient.init(yarnConfiguration); nodeManagerClient.start(); nodeManagerClient.cleanupRunningContainersOnStop(true); return nodeManagerClient; }
@Override public TimelinePutResponse run() throws Exception { return timelineClient.putEntities(entity); } });
public YarnRMClient(YarnConfiguration conf) { this.conf = conf; yarnClient = YarnClient.createYarnClient(); yarnClient.init(conf); yarnClient.start(); }
JstormOnYarn(String appMasterMainClass, Configuration conf) { this.jstormClientContext.conf = conf; this.appMasterMainClass = appMasterMainClass; jstormClientContext.yarnClient = YarnClient.createYarnClient(); jstormClientContext.yarnClient.init(conf); jstormClientContext.opts = JstormYarnUtils.initClientOptions(); }
/** * Kills YARN application and stops YARN client. * * <p>Use this method to kill the App before it has been properly deployed */ private void failSessionDuringDeployment(YarnClient yarnClient, YarnClientApplication yarnApplication) { LOG.info("Killing YARN application"); try { yarnClient.killApplication(yarnApplication.getNewApplicationResponse().getApplicationId()); } catch (Exception e) { // we only log a debug message here because the "killApplication" call is a best-effort // call (we don't know if the application has been deployed when the error occured). LOG.debug("Error while killing YARN application", e); } yarnClient.stop(); }
private static ApplicationReport getApplicationReport(ApplicationId appId, YarnClient yarnClient) throws YarnException, IOException { return yarnClient.getApplicationReport(appId); }
public GetNewApplicationResponse createAppMaster() throws YarnClientException { // Create application via yarnClient // Response is a new application ID along with cluster capacity info try { app = yarnClient.createApplication(); } catch (YarnException | IOException e) { throw new YarnClientException("Create application failed", e); } GetNewApplicationResponse response = app.getNewApplicationResponse(); appId = response.getApplicationId(); return response; }
/** * Kill a submitted application by sending a call to the ASM * * @param appId Application Id to be killed. * @throws YarnException * @throws IOException */ private void forceKillApplication(ApplicationId appId) throws YarnException, IOException { jstormClientContext.yarnClient.killApplication(appId); }
@Nonnull private AMRMClient.ContainerRequest createContainerRequest(Resource capability) { return new AMRMClient.ContainerRequest(capability, null, null, RM_REQUEST_PRIORITY); }
@Override public void run() { try { executor.shutdown(); executor.awaitTermination(WAIT_TIME, TimeUnit.SECONDS); executor = null; } catch(InterruptedException ie) { /* ignore */ } timelineClient.stop(); } });
/** {@inheritDoc} */ public void onError(Throwable t) { nmClient.stop(); }
private AbstractYarnClusterDescriptor getClusterDescriptor( Configuration configuration, YarnConfiguration yarnConfiguration, String configurationDirectory) { final YarnClient yarnClient = YarnClient.createYarnClient(); yarnClient.init(yarnConfiguration); yarnClient.start(); return new YarnClusterDescriptor( configuration, yarnConfiguration, configurationDirectory, yarnClient, false); } }
private void tryRetrieveAndLogApplicationReport(YarnClient yarnClient, ApplicationId yarnApplicationId) { ApplicationReport applicationReport; try { applicationReport = yarnClient.getApplicationReport(yarnApplicationId); } catch (YarnException | IOException e) { LOG.info("Could not log the final application report.", e); applicationReport = null; } if (applicationReport != null) { logApplicationReport(applicationReport); } }
@AfterClass public static void tearDownClass() { yarnClient.stop(); }
@Nonnull @VisibleForTesting AMRMClient.ContainerRequest getContainerRequest() { return new AMRMClient.ContainerRequest( getContainerResource(), null, null, RM_REQUEST_PRIORITY); }
@Override public void run() { try { timelineClient.putEntities(entity); } catch (Exception err) { LOG.warn("Failed to send event to ATS", err); } } });
@BeforeClass public static void setupClass() { yarnConfiguration = new YarnConfiguration(); yarnClient = YarnClient.createYarnClient(); yarnClient.init(yarnConfiguration); yarnClient.start(); }
public ApplicationReport getAppReport() throws YarnClientException { try { return yarnClient.getApplicationReport(appId); } catch (YarnException | IOException e) { throw new YarnClientException("Get application report failed", e); } }
@Before public void checkClusterEmpty() { if (yarnClient == null) { yarnClient = YarnClient.createYarnClient(); yarnClient.init(getYarnConfiguration()); yarnClient.start(); } flinkConfiguration = new org.apache.flink.configuration.Configuration(globalConfiguration); }