Exemplo n.º 1
0
  @Override
  public void killApplication(ApplicationId applicationId) throws YarnException, IOException {
    KillApplicationRequest request = Records.newRecord(KillApplicationRequest.class);
    request.setApplicationId(applicationId);

    try {
      int pollCount = 0;
      long startTime = System.currentTimeMillis();

      while (true) {
        KillApplicationResponse response = rmClient.forceKillApplication(request);
        if (response.getIsKillCompleted()) {
          LOG.info("Killed application " + applicationId);
          break;
        }

        long elapsedMillis = System.currentTimeMillis() - startTime;
        if (enforceAsyncAPITimeout() && elapsedMillis >= this.asyncApiPollTimeoutMillis) {
          throw new YarnException(
              "Timed out while waiting for application " + applicationId + " to be killed.");
        }

        if (++pollCount % 10 == 0) {
          LOG.info("Waiting for application " + applicationId + " to be killed.");
        }
        Thread.sleep(asyncApiPollIntervalMillis);
      }
    } catch (InterruptedException e) {
      LOG.error("Interrupted while waiting for application " + applicationId + " to be killed.");
    }
  }
Exemplo n.º 2
0
 @Public
 @Stable
 public static KillApplicationRequest newInstance(ApplicationId applicationId) {
   KillApplicationRequest request = Records.newRecord(KillApplicationRequest.class);
   request.setApplicationId(applicationId);
   return request;
 }
 public void killApplication(String appId) throws Exception {
   KillApplicationRequest killRequest = Records.newRecord(KillApplicationRequest.class);
   ApplicationId aid = Records.newRecord(ApplicationId.class);
   long ts = Long.parseLong(appId.substring(appId.indexOf('_') + 1, appId.lastIndexOf('_')));
   aid.setClusterTimestamp(ts);
   int id = Integer.parseInt(appId.substring(appId.lastIndexOf('_') + 1));
   aid.setId(id);
   killRequest.setApplicationId(aid);
   crmp.forceKillApplication(killRequest);
 }
 public void killApplication(ApplicationId applicationId) throws IOException {
   KillApplicationRequest request = recordFactory.newRecordInstance(KillApplicationRequest.class);
   request.setApplicationId(applicationId);
   applicationsManager.forceKillApplication(request);
   LOG.info("Killing application " + applicationId);
 }