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


Java Application类代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application的典型用法代码示例。如果您正苦于以下问题:Java Application类的具体用法?Java Application怎么用?Java Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Application类属于org.apache.hadoop.yarn.server.nodemanager.containermanager.application包,在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
@Override
protected void render(Block html) {

  TBODY<TABLE<BODY<Hamlet>>> tableBody =
    html
      .body()
        .table("#applications")
          .thead()
            .tr()
              .td()._("ApplicationId")._()
              .td()._("ApplicationState")._()
            ._()
           ._()
           .tbody();
  for (Entry<ApplicationId, Application> entry : this.nmContext
      .getApplications().entrySet()) {
    AppInfo info = new AppInfo(entry.getValue());
    tableBody
      .tr()
        .td().a(url("application", info.getId()), info.getId())._()
        .td()._(info.getState())
        ._()
      ._();
  }
  tableBody._()._()._();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:AllApplicationsPage.java

示例2: render

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
@Override
protected void render(Block html) {
  ApplicationId applicationID =
      ConverterUtils.toApplicationId(this.recordFactory,
          $(APPLICATION_ID));
  Application app = this.nmContext.getApplications().get(applicationID);
  AppInfo info = new AppInfo(app);
  info("Application's information")
        ._("ApplicationId", info.getId())
        ._("ApplicationState", info.getState())
        ._("User", info.getUser());
  TABLE<Hamlet> containersListBody = html._(InfoBlock.class)
      .table("#containers");
  for (String containerIdStr : info.getContainers()) {
    containersListBody
           .tr().td()
             .a(url("container", containerIdStr), containerIdStr)
             ._()._();
  }
  containersListBody._();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:ApplicationPage.java

示例3: getContainerLogDirs

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
/**
 * Finds the local directories that logs for the given container are stored
 * on.
 */
public static List<File> getContainerLogDirs(ContainerId containerId,
    String remoteUser, Context context) throws YarnException {
  Container container = context.getContainers().get(containerId);

  Application application = getApplicationForContainer(containerId, context);
  checkAccess(remoteUser, application, context);
  // It is not required to have null check for container ( container == null )
  // and throw back exception.Because when container is completed, NodeManager
  // remove container information from its NMContext.Configuring log
  // aggregation to false, container log view request is forwarded to NM. NM
  // does not have completed container information,but still NM serve request for
  // reading container logs. 
  if (container != null) {
    checkState(container.getContainerState());
  }
  
  return getContainerLogDirs(containerId, context.getLocalDirsHandler());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:ContainerLogsUtils.java

示例4: getContainerLogFile

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
/**
 * Finds the log file with the given filename for the given container.
 */
public static File getContainerLogFile(ContainerId containerId,
    String fileName, String remoteUser, Context context) throws YarnException {
  Container container = context.getContainers().get(containerId);
  
  Application application = getApplicationForContainer(containerId, context);
  checkAccess(remoteUser, application, context);
  if (container != null) {
    checkState(container.getContainerState());
  }
  
  try {
    LocalDirsHandlerService dirsHandler = context.getLocalDirsHandler();
    String relativeContainerLogDir = ContainerLaunch.getRelativeContainerLogDir(
        application.getAppId().toString(), containerId.toString());
    Path logPath = dirsHandler.getLogPathToRead(
        relativeContainerLogDir + Path.SEPARATOR + fileName);
    URI logPathURI = new File(logPath.toString()).toURI();
    File logFile = new File(logPathURI.getPath());
    return logFile;
  } catch (IOException e) {
    LOG.warn("Failed to find log file", e);
    throw new NotFoundException("Cannot find this log on the local disk.");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:ContainerLogsUtils.java

示例5: checkAccess

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
private static void checkAccess(String remoteUser, Application application,
    Context context) throws YarnException {
  UserGroupInformation callerUGI = null;
  if (remoteUser != null) {
    callerUGI = UserGroupInformation.createRemoteUser(remoteUser);
  }
  if (callerUGI != null
      && !context.getApplicationACLsManager().checkAccess(callerUGI,
          ApplicationAccessType.VIEW_APP, application.getUser(),
          application.getAppId())) {
    throw new YarnException(
        "User [" + remoteUser
            + "] is not authorized to view the logs for application "
            + application.getAppId());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:ContainerLogsUtils.java

示例6: getNodeApp

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
@GET
@Path("/apps/{appid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppInfo getNodeApp(@PathParam("appid") String appId) {
  init();
  ApplicationId id = ConverterUtils.toApplicationId(recordFactory, appId);
  if (id == null) {
    throw new NotFoundException("app with id " + appId + " not found");
  }
  Application app = this.nmContext.getApplications().get(id);
  if (app == null) {
    throw new NotFoundException("app with id " + appId + " not found");
  }
  return new AppInfo(app);

}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:NMWebServices.java

示例7: handleInitApplicationResources

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
/**
 * Handle event received the first time any container is scheduled
 * by a given application.
 */
@SuppressWarnings("unchecked")
private void handleInitApplicationResources(Application app) {
  // 0) Create application tracking structs
  String userName = app.getUser();
  privateRsrc.putIfAbsent(userName, new LocalResourcesTrackerImpl(userName,
      null, dispatcher, true, super.getConfig(), stateStore));
  String appIdStr = ConverterUtils.toString(app.getAppId());
  appRsrc.putIfAbsent(appIdStr, new LocalResourcesTrackerImpl(app.getUser(),
      app.getAppId(), dispatcher, false, super.getConfig(), stateStore));
  // 1) Signal container init
  //
  // This is handled by the ApplicationImpl state machine and allows
  // containers to proceed with launching.
  dispatcher.getEventHandler().handle(new ApplicationInitedEvent(
        app.getAppId()));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:ResourceLocalizationService.java

示例8: ContainerLaunch

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
public ContainerLaunch(Context context, Configuration configuration,
    Dispatcher dispatcher, ContainerExecutor exec, Application app,
    Container container, LocalDirsHandlerService dirsHandler,
    ContainerManagerImpl containerManager) {
  this.context = context;
  this.conf = configuration;
  this.app = app;
  this.exec = exec;
  this.container = container;
  this.dispatcher = dispatcher;
  this.dirsHandler = dirsHandler;
  this.containerManager = containerManager;
  this.sleepDelayBeforeSigKill =
      conf.getLong(YarnConfiguration.NM_SLEEP_DELAY_BEFORE_SIGKILL_MS,
          YarnConfiguration.DEFAULT_NM_SLEEP_DELAY_BEFORE_SIGKILL_MS);
  this.maxKillWaitTime =
      conf.getLong(YarnConfiguration.NM_PROCESS_KILL_WAIT_MS,
          YarnConfiguration.DEFAULT_NM_PROCESS_KILL_WAIT_MS);

  this.olr = new OwnLocalResources();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:ContainerLaunch.java

示例9: addAppContainers

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
private HashMap<String, String> addAppContainers(Application app) 
    throws IOException {
  Dispatcher dispatcher = new AsyncDispatcher();
  ApplicationAttemptId appAttemptId = BuilderUtils.newApplicationAttemptId(
      app.getAppId(), 1);
  Container container1 = new MockContainer(appAttemptId, dispatcher, conf,
      app.getUser(), app.getAppId(), 1);
  Container container2 = new MockContainer(appAttemptId, dispatcher, conf,
      app.getUser(), app.getAppId(), 2);
  nmContext.getContainers()
      .put(container1.getContainerId(), container1);
  nmContext.getContainers()
      .put(container2.getContainerId(), container2);

  app.getContainers().put(container1.getContainerId(), container1);
  app.getContainers().put(container2.getContainerId(), container2);
  HashMap<String, String> hash = new HashMap<String, String>();
  hash.put(container1.getContainerId().toString(), container1
      .getContainerId().toString());
  hash.put(container2.getContainerId().toString(), container2
      .getContainerId().toString());
  return hash;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestNMWebServicesApps.java

示例10: testNodeAppsUser

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
@Test
public void testNodeAppsUser() throws JSONException, Exception {
  WebResource r = resource();
  Application app = new MockApp(1);
  nmContext.getApplications().put(app.getAppId(), app);
  HashMap<String, String> hash = addAppContainers(app);
  Application app2 = new MockApp("foo", 1234, 2);
  nmContext.getApplications().put(app2.getAppId(), app2);
  addAppContainers(app2);

  ClientResponse response = r.path("ws").path("v1").path("node").path("apps")
      .queryParam("user", "mockUser").accept(MediaType.APPLICATION_JSON)
      .get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);

  JSONObject info = json.getJSONObject("apps");
  assertEquals("incorrect number of elements", 1, info.length());
  JSONArray appInfo = info.getJSONArray("app");
  assertEquals("incorrect number of elements", 1, appInfo.length());
  verifyNodeAppInfo(appInfo.getJSONObject(0), app, hash);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestNMWebServicesApps.java

示例11: testNodeAppsUserNone

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
@Test
public void testNodeAppsUserNone() throws JSONException, Exception {
  WebResource r = resource();
  Application app = new MockApp(1);
  nmContext.getApplications().put(app.getAppId(), app);
  addAppContainers(app);
  Application app2 = new MockApp("foo", 1234, 2);
  nmContext.getApplications().put(app2.getAppId(), app2);
  addAppContainers(app2);

  ClientResponse response = r.path("ws").path("v1").path("node").path("apps")
      .queryParam("user", "george").accept(MediaType.APPLICATION_JSON)
      .get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("apps is not null", JSONObject.NULL, json.get("apps"));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestNMWebServicesApps.java

示例12: testNodeAppsState

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
@Test
public void testNodeAppsState() throws JSONException, Exception {
  WebResource r = resource();
  Application app = new MockApp(1);
  nmContext.getApplications().put(app.getAppId(), app);
  addAppContainers(app);
  MockApp app2 = new MockApp("foo", 1234, 2);
  nmContext.getApplications().put(app2.getAppId(), app2);
  HashMap<String, String> hash2 = addAppContainers(app2);
  app2.setState(ApplicationState.RUNNING);

  ClientResponse response = r.path("ws").path("v1").path("node").path("apps")
      .queryParam("state", ApplicationState.RUNNING.toString())
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);

  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);

  JSONObject info = json.getJSONObject("apps");
  assertEquals("incorrect number of elements", 1, info.length());
  JSONArray appInfo = info.getJSONArray("app");
  assertEquals("incorrect number of elements", 1, appInfo.length());
  verifyNodeAppInfo(appInfo.getJSONObject(0), app2, hash2);

}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TestNMWebServicesApps.java

示例13: testNodeAppsStateNone

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
@Test
public void testNodeAppsStateNone() throws JSONException, Exception {
  WebResource r = resource();
  Application app = new MockApp(1);
  nmContext.getApplications().put(app.getAppId(), app);
  addAppContainers(app);
  Application app2 = new MockApp("foo", 1234, 2);
  nmContext.getApplications().put(app2.getAppId(), app2);
  addAppContainers(app2);

  ClientResponse response = r.path("ws").path("v1").path("node").path("apps")
      .queryParam("state", ApplicationState.INITING.toString())
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);

  assertEquals("apps is not null", JSONObject.NULL, json.get("apps"));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestNMWebServicesApps.java

示例14: testNodeSingleAppHelper

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
public void testNodeSingleAppHelper(String media) throws JSONException,
    Exception {
  WebResource r = resource();
  Application app = new MockApp(1);
  nmContext.getApplications().put(app.getAppId(), app);
  HashMap<String, String> hash = addAppContainers(app);
  Application app2 = new MockApp(2);
  nmContext.getApplications().put(app2.getAppId(), app2);
  addAppContainers(app2);

  ClientResponse response = r.path("ws").path("v1").path("node").path("apps")
      .path(app.getAppId().toString()).accept(media)
      .get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  verifyNodeAppInfo(json.getJSONObject("app"), app, hash);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestNMWebServicesApps.java

示例15: testNodeSingleAppsSlash

import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application; //导入依赖的package包/类
@Test
public void testNodeSingleAppsSlash() throws JSONException, Exception {
  WebResource r = resource();
  Application app = new MockApp(1);
  nmContext.getApplications().put(app.getAppId(), app);
  HashMap<String, String> hash = addAppContainers(app);
  Application app2 = new MockApp(2);
  nmContext.getApplications().put(app2.getAppId(), app2);
  addAppContainers(app2);
  ClientResponse response = r.path("ws").path("v1").path("node").path("apps")
      .path(app.getAppId().toString() + "/")
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);

  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  verifyNodeAppInfo(json.getJSONObject("app"), app, hash);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestNMWebServicesApps.java


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