当前位置: 首页>>代码示例>>Java>>正文


Java KillApplicationRequest.setApplicationId方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest.setApplicationId方法的典型用法代码示例。如果您正苦于以下问题:Java KillApplicationRequest.setApplicationId方法的具体用法?Java KillApplicationRequest.setApplicationId怎么用?Java KillApplicationRequest.setApplicationId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest的用法示例。


在下文中一共展示了KillApplicationRequest.setApplicationId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyOwnerAccess

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
private void verifyOwnerAccess() throws Exception {

    AccessControlList viewACL = new AccessControlList("");
    viewACL.addGroup(FRIENDLY_GROUP);
    AccessControlList modifyACL = new AccessControlList("");
    modifyACL.addUser(FRIEND);
    ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

    final GetApplicationReportRequest appReportRequest = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    appReportRequest.setApplicationId(applicationId);
    final KillApplicationRequest finishAppRequest = recordFactory
        .newRecordInstance(KillApplicationRequest.class);
    finishAppRequest.setApplicationId(applicationId);

    // View as owner
    rmClient.getApplicationReport(appReportRequest);

    // List apps as owner
    Assert.assertEquals("App view by owner should list the apps!!", 1,
        rmClient.getApplications(
            recordFactory.newRecordInstance(GetApplicationsRequest.class))
            .getApplicationList().size());

    // Kill app as owner
    rmClient.forceKillApplication(finishAppRequest);
    resourceManager.waitForState(applicationId, RMAppState.KILLED);
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestApplicationACLs.java

示例2: verifySuperUserAccess

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
private void verifySuperUserAccess() throws Exception {

    AccessControlList viewACL = new AccessControlList("");
    viewACL.addGroup(FRIENDLY_GROUP);
    AccessControlList modifyACL = new AccessControlList("");
    modifyACL.addUser(FRIEND);
    ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

    final GetApplicationReportRequest appReportRequest = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    appReportRequest.setApplicationId(applicationId);
    final KillApplicationRequest finishAppRequest = recordFactory
        .newRecordInstance(KillApplicationRequest.class);
    finishAppRequest.setApplicationId(applicationId);

    ApplicationClientProtocol superUserClient = getRMClientForUser(SUPER_USER);

    // View as the superUser
    superUserClient.getApplicationReport(appReportRequest);

    // List apps as superUser
    Assert.assertEquals("App view by super-user should list the apps!!", 2,
        superUserClient.getApplications(
            recordFactory.newRecordInstance(GetApplicationsRequest.class))
            .getApplicationList().size());

    // Kill app as the superUser
    superUserClient.forceKillApplication(finishAppRequest);
    resourceManager.waitForState(applicationId, RMAppState.KILLED);
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestApplicationACLs.java

示例3: verifyFriendAccess

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
private void verifyFriendAccess() throws Exception {

    AccessControlList viewACL = new AccessControlList("");
    viewACL.addGroup(FRIENDLY_GROUP);
    AccessControlList modifyACL = new AccessControlList("");
    modifyACL.addUser(FRIEND);
    ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

    final GetApplicationReportRequest appReportRequest = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    appReportRequest.setApplicationId(applicationId);
    final KillApplicationRequest finishAppRequest = recordFactory
        .newRecordInstance(KillApplicationRequest.class);
    finishAppRequest.setApplicationId(applicationId);

    ApplicationClientProtocol friendClient = getRMClientForUser(FRIEND);

    // View as the friend
    friendClient.getApplicationReport(appReportRequest);

    // List apps as friend
    Assert.assertEquals("App view by a friend should list the apps!!", 3,
        friendClient.getApplications(
            recordFactory.newRecordInstance(GetApplicationsRequest.class))
            .getApplicationList().size());

    // Kill app as the friend
    friendClient.forceKillApplication(finishAppRequest);
    resourceManager.waitForState(applicationId, RMAppState.KILLED);
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestApplicationACLs.java

示例4: verifyAdministerQueueUserAccess

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
private void verifyAdministerQueueUserAccess() throws Exception {
  isQueueUser = true;
  AccessControlList viewACL = new AccessControlList("");
  viewACL.addGroup(FRIENDLY_GROUP);
  AccessControlList modifyACL = new AccessControlList("");
  modifyACL.addUser(FRIEND);
  ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

  final GetApplicationReportRequest appReportRequest = recordFactory
      .newRecordInstance(GetApplicationReportRequest.class);
  appReportRequest.setApplicationId(applicationId);
  final KillApplicationRequest finishAppRequest = recordFactory
      .newRecordInstance(KillApplicationRequest.class);
  finishAppRequest.setApplicationId(applicationId);

  ApplicationClientProtocol administerQueueUserRmClient =
      getRMClientForUser(QUEUE_ADMIN_USER);

  // View as the administerQueueUserRmClient
  administerQueueUserRmClient.getApplicationReport(appReportRequest);

  // List apps as administerQueueUserRmClient
  Assert.assertEquals("App view by queue-admin-user should list the apps!!",
      5, administerQueueUserRmClient.getApplications(
             recordFactory.newRecordInstance(GetApplicationsRequest.class))
             .getApplicationList().size());

  // Kill app as the administerQueueUserRmClient
  administerQueueUserRmClient.forceKillApplication(finishAppRequest);
  resourceManager.waitForState(applicationId, RMAppState.KILLED);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:32,代码来源:TestApplicationACLs.java

示例5: killApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
@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.");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:37,代码来源:YarnClientImpl.java

示例6: killApp

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
public void killApp(ApplicationId appId) throws Exception {
  ApplicationClientProtocol client = getClientRMService();
  KillApplicationRequest req = Records
      .newRecord(KillApplicationRequest.class);
  req.setApplicationId(appId);
  client.forceKillApplication(req);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:8,代码来源:MockRM.java

示例7: killApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
@Override
public void killApplication(ApplicationId applicationId)
    throws YarnException, IOException {
  LOG.info("Killing application " + applicationId);
  KillApplicationRequest request =
      Records.newRecord(KillApplicationRequest.class);
  request.setApplicationId(applicationId);
  rmClient.forceKillApplication(request);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:10,代码来源:YarnClientImpl.java

示例8: killApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:11,代码来源:YarnClientRMConnection.java

示例9: killRunningApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
/**
 * Kill a running application
 * @param applicationId
 * @return the response
 * @throws YarnException YARN problems
 * @throws IOException IO problems
 */
public  KillApplicationResponse killRunningApplication(ApplicationId applicationId,
                                                       String reason) throws
                                                                      YarnException,
                                                                      IOException {
  log.info("Killing application {} - {}", applicationId.getClusterTimestamp(),
           reason);
  KillApplicationRequest request =
    Records.newRecord(KillApplicationRequest.class);
  request.setApplicationId(applicationId);
  return getRmClient().forceKillApplication(request);
}
 
开发者ID:apache,项目名称:incubator-slider,代码行数:19,代码来源:SliderYarnClientImpl.java

示例10: verifyEnemyAccess

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
private void verifyEnemyAccess() throws Exception {

    AccessControlList viewACL = new AccessControlList("");
    viewACL.addGroup(FRIENDLY_GROUP);
    AccessControlList modifyACL = new AccessControlList("");
    modifyACL.addUser(FRIEND);
    ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

    final GetApplicationReportRequest appReportRequest = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    appReportRequest.setApplicationId(applicationId);
    final KillApplicationRequest finishAppRequest = recordFactory
        .newRecordInstance(KillApplicationRequest.class);
    finishAppRequest.setApplicationId(applicationId);

    ApplicationClientProtocol enemyRmClient = getRMClientForUser(ENEMY);

    // View as the enemy
    ApplicationReport appReport = enemyRmClient.getApplicationReport(
        appReportRequest).getApplicationReport();
    verifyEnemyAppReport(appReport);

    // List apps as enemy
    List<ApplicationReport> appReports = enemyRmClient
        .getApplications(recordFactory
            .newRecordInstance(GetApplicationsRequest.class))
        .getApplicationList();
    Assert.assertEquals("App view by enemy should list the apps!!", 4,
        appReports.size());
    for (ApplicationReport report : appReports) {
      verifyEnemyAppReport(report);
    }

    // Kill app as the enemy
    try {
      enemyRmClient.forceKillApplication(finishAppRequest);
      Assert.fail("App killing by the enemy should fail!!");
    } catch (YarnException e) {
      LOG.info("Got exception while killing app as the enemy", e);
      Assert
          .assertTrue(e.getMessage().contains(
              "User enemy cannot perform operation MODIFY_APP on "
                  + applicationId));
    }

    rmClient.forceKillApplication(finishAppRequest);
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:48,代码来源:TestApplicationACLs.java

示例11: killApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
@Override
public void killApplication(ApplicationId applicationId, String diagnostics)
    throws YarnException, IOException {

  KillApplicationRequest request =
      Records.newRecord(KillApplicationRequest.class);
  request.setApplicationId(applicationId);

  if (diagnostics != null) {
    request.setDiagnostics(diagnostics);
  }

  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) {
    String msg = "Interrupted while waiting for application "
        + applicationId + " to be killed.";
    LOG.error(msg);
    throw new YarnException(msg, e);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:45,代码来源:YarnClientImpl.java


注:本文中的org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest.setApplicationId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。