Java Code Examples for org.apache.hadoop.yarn.client.api.YarnClient#killApplication()
The following examples show how to use
org.apache.hadoop.yarn.client.api.YarnClient#killApplication() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestYarnClient.java From hadoop with Apache License 2.0 | 6 votes |
@Test public void testKillApplication() throws Exception { MockRM rm = new MockRM(); rm.start(); RMApp app = rm.submitApp(2000); Configuration conf = new Configuration(); @SuppressWarnings("resource") final YarnClient client = new MockYarnClient(); client.init(conf); client.start(); client.killApplication(app.getApplicationId()); verify(((MockYarnClient) client).getRMClient(), times(2)) .forceKillApplication(any(KillApplicationRequest.class)); }
Example 2
Source File: TestYarnClient.java From big-c with Apache License 2.0 | 6 votes |
@Test public void testKillApplication() throws Exception { MockRM rm = new MockRM(); rm.start(); RMApp app = rm.submitApp(2000); Configuration conf = new Configuration(); @SuppressWarnings("resource") final YarnClient client = new MockYarnClient(); client.init(conf); client.start(); client.killApplication(app.getApplicationId()); verify(((MockYarnClient) client).getRMClient(), times(2)) .forceKillApplication(any(KillApplicationRequest.class)); }
Example 3
Source File: AbstractYarnClusterDescriptor.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 4
Source File: YARNHighAvailabilityITCase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void killApplicationAndWait(final ApplicationId id) throws Exception { final YarnClient yarnClient = getYarnClient(); checkState(yarnClient != null, "yarnClient must be initialized"); yarnClient.killApplication(id); CommonTestUtils.waitUntilCondition(() -> !yarnClient.getApplications(EnumSet.of(YarnApplicationState.KILLED, YarnApplicationState.FINISHED)).isEmpty(), Deadline.fromNow(TIMEOUT)); }
Example 5
Source File: AbstractYarnClusterDescriptor.java From flink with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 6
Source File: YARNHighAvailabilityITCase.java From flink with Apache License 2.0 | 5 votes |
private void killApplicationAndWait(final ApplicationId id) throws Exception { final YarnClient yarnClient = getYarnClient(); checkState(yarnClient != null, "yarnClient must be initialized"); yarnClient.killApplication(id); CommonTestUtils.waitUntilCondition(() -> !yarnClient.getApplications(EnumSet.of(YarnApplicationState.KILLED, YarnApplicationState.FINISHED)).isEmpty(), Deadline.fromNow(TIMEOUT)); }
Example 7
Source File: YarnJobDescriptor.java From sylph with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 8
Source File: Hadoop21YarnAppClient.java From twill with Apache License 2.0 | 5 votes |
@Override public void cancel() { YarnClient yarnClient = createYarnClient(); try { yarnClient.killApplication(appId); } catch (YarnException | IOException e) { throw new RuntimeException("Failed to kill application " + appId, e); } finally { yarnClient.stop(); } }
Example 9
Source File: EmrClusterJob.java From datacollector with Apache License 2.0 | 5 votes |
@Override public void terminateJob(Properties jobProps) throws IOException { String appIdStr = Utils.checkNotNull(jobProps.getProperty("appId"), null); if (appIdStr == null) { throw new IOException("appId not present in jobProps"); } YarnClient yarnClient = getYarnClient(new EMRJobConfig(jobProps).getClusterId(), emrClusterConfig); ApplicationId appId = ApplicationId.fromString(appIdStr); try { yarnClient.killApplication(appId); } catch (YarnException ex) { throw new IOException("Failed to terminate yarn job " + ex); } }
Example 10
Source File: YarnClusterDescriptor.java From flink with Apache License 2.0 | 5 votes |
/** * 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); } }
Example 11
Source File: YARNHighAvailabilityITCase.java From flink with Apache License 2.0 | 5 votes |
private void killApplicationAndWait(final ApplicationId id) throws Exception { final YarnClient yarnClient = getYarnClient(); checkState(yarnClient != null, "yarnClient must be initialized"); yarnClient.killApplication(id); CommonTestUtils.waitUntilCondition(() -> !yarnClient.getApplications(EnumSet.of(YarnApplicationState.KILLED, YarnApplicationState.FINISHED)).isEmpty(), Deadline.fromNow(TIMEOUT)); }