Java Code Examples for org.apache.hadoop.yarn.webapp.YarnWebParams

The following examples show how to use org.apache.hadoop.yarn.webapp.YarnWebParams. These examples are extracted from open source projects. 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 Project: hadoop   Source File: TestAggregatedLogsBlock.java    License: Apache License 2.0 6 votes vote down vote up
private AggregatedLogsBlockForTest getAggregatedLogsBlockForTest(
    Configuration configuration, String user, String containerId) {
  HttpServletRequest request = mock(HttpServletRequest.class);
  when(request.getRemoteUser()).thenReturn(user);
  AggregatedLogsBlockForTest aggregatedBlock = new AggregatedLogsBlockForTest(
      configuration);
  aggregatedBlock.setRequest(request);
  aggregatedBlock.moreParams().put(YarnWebParams.CONTAINER_ID, containerId);
  aggregatedBlock.moreParams().put(YarnWebParams.NM_NODENAME,
      "localhost:1234");
  aggregatedBlock.moreParams().put(YarnWebParams.APP_OWNER, user);
  aggregatedBlock.moreParams().put("start", "");
  aggregatedBlock.moreParams().put("end", "");
  aggregatedBlock.moreParams().put(YarnWebParams.ENTITY_STRING, "entity");
  return aggregatedBlock;
}
 
Example 2
Source Project: hadoop   Source File: RmController.java    License: Apache License 2.0 6 votes vote down vote up
public void scheduler() {
  // limit applications to those in states relevant to scheduling
  set(YarnWebParams.APP_STATE, StringHelper.cjoin(
      YarnApplicationState.NEW.toString(),
      YarnApplicationState.NEW_SAVING.toString(),
      YarnApplicationState.SUBMITTED.toString(),
      YarnApplicationState.ACCEPTED.toString(),
      YarnApplicationState.RUNNING.toString()));

  ResourceManager rm = getInstance(ResourceManager.class);
  ResourceScheduler rs = rm.getResourceScheduler();
  if (rs == null || rs instanceof CapacityScheduler) {
    setTitle("Capacity Scheduler");
    render(CapacitySchedulerPage.class);
    return;
  }
  
  if (rs instanceof FairScheduler) {
    setTitle("Fair Scheduler");
    render(FairSchedulerPage.class);
    return;
  }
  
  setTitle("Default Scheduler");
  render(DefaultSchedulerPage.class);
}
 
Example 3
Source Project: hadoop   Source File: AppAttemptPage.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);

  String appAttemptId = $(YarnWebParams.APPLICATION_ATTEMPT_ID);
  set(
    TITLE,
    appAttemptId.isEmpty() ? "Bad request: missing application attempt ID"
        : join("Application Attempt ",
          $(YarnWebParams.APPLICATION_ATTEMPT_ID)));

  set(DATATABLES_ID, "containers");
  set(initID(DATATABLES, "containers"), WebPageUtils.containersTableInit());
  setTableStyles(html, "containers", ".queue {width:6em}", ".ui {width:8em}");

  set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.RM_WEB_UI);
}
 
Example 4
Source Project: hadoop   Source File: AppPage.java    License: Apache License 2.0 6 votes vote down vote up
@Override 
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);
  String appId = $(YarnWebParams.APPLICATION_ID);
  set(
    TITLE,
    appId.isEmpty() ? "Bad request: missing application ID" : join(
      "Application ", $(YarnWebParams.APPLICATION_ID)));

  set(DATATABLES_ID, "attempts ResourceRequests");
  set(initID(DATATABLES, "attempts"), WebPageUtils.attemptsTableInit());
  setTableStyles(html, "attempts", ".queue {width:6em}", ".ui {width:8em}");

  setTableStyles(html, "ResourceRequests");

  set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.RM_WEB_UI);
}
 
Example 5
Source Project: hadoop   Source File: AppAttemptPage.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);

  String appAttemptId = $(YarnWebParams.APPLICATION_ATTEMPT_ID);
  set(
    TITLE,
    appAttemptId.isEmpty() ? "Bad request: missing application attempt ID"
        : join("Application Attempt ",
          $(YarnWebParams.APPLICATION_ATTEMPT_ID)));

  set(DATATABLES_ID, "containers");
  set(initID(DATATABLES, "containers"), WebPageUtils.containersTableInit());
  setTableStyles(html, "containers", ".queue {width:6em}", ".ui {width:8em}");

  set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.APP_HISTORY_WEB_UI);
}
 
Example 6
Source Project: hadoop   Source File: AppPage.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);

  String appId = $(YarnWebParams.APPLICATION_ID);
  set(
    TITLE,
    appId.isEmpty() ? "Bad request: missing application ID" : join(
      "Application ", $(YarnWebParams.APPLICATION_ID)));

  set(DATATABLES_ID, "attempts ResourceRequests");
  set(initID(DATATABLES, "attempts"), WebPageUtils.attemptsTableInit());
  setTableStyles(html, "attempts", ".queue {width:6em}", ".ui {width:8em}");

  setTableStyles(html, "ResourceRequests");

  set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.APP_HISTORY_WEB_UI);
}
 
Example 7
Source Project: hadoop   Source File: TestAHSWebApp.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testView() throws Exception {
  Injector injector =
      WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
        mockApplicationHistoryClientService(5, 1, 1));
  AHSView ahsViewInstance = injector.getInstance(AHSView.class);

  ahsViewInstance.render();
  WebAppTests.flushOutput(injector);

  ahsViewInstance.set(YarnWebParams.APP_STATE,
    YarnApplicationState.FAILED.toString());
  ahsViewInstance.render();
  WebAppTests.flushOutput(injector);

  ahsViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
    YarnApplicationState.FAILED.toString(), YarnApplicationState.KILLED));
  ahsViewInstance.render();
  WebAppTests.flushOutput(injector);
}
 
Example 8
Source Project: hadoop   Source File: TestAHSWebApp.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testAppAttemptPage() throws Exception {
  Injector injector =
      WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
        mockApplicationHistoryClientService(1, 1, 5));
  AppAttemptPage appAttemptPageInstance =
      injector.getInstance(AppAttemptPage.class);

  appAttemptPageInstance.render();
  WebAppTests.flushOutput(injector);

  appAttemptPageInstance.set(YarnWebParams.APPLICATION_ATTEMPT_ID,
    ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1)
      .toString());
  appAttemptPageInstance.render();
  WebAppTests.flushOutput(injector);
}
 
Example 9
Source Project: hadoop   Source File: TestAHSWebApp.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testContainerPage() throws Exception {
  Injector injector =
      WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
        mockApplicationHistoryClientService(1, 1, 1));
  ContainerPage containerPageInstance =
      injector.getInstance(ContainerPage.class);

  containerPageInstance.render();
  WebAppTests.flushOutput(injector);

  containerPageInstance.set(
    YarnWebParams.CONTAINER_ID,
    ContainerId
      .newContainerId(
        ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1),
        1).toString());
  containerPageInstance.render();
  WebAppTests.flushOutput(injector);
}
 
Example 10
Source Project: big-c   Source File: TestAggregatedLogsBlock.java    License: Apache License 2.0 6 votes vote down vote up
private AggregatedLogsBlockForTest getAggregatedLogsBlockForTest(
    Configuration configuration, String user, String containerId) {
  HttpServletRequest request = mock(HttpServletRequest.class);
  when(request.getRemoteUser()).thenReturn(user);
  AggregatedLogsBlockForTest aggregatedBlock = new AggregatedLogsBlockForTest(
      configuration);
  aggregatedBlock.setRequest(request);
  aggregatedBlock.moreParams().put(YarnWebParams.CONTAINER_ID, containerId);
  aggregatedBlock.moreParams().put(YarnWebParams.NM_NODENAME,
      "localhost:1234");
  aggregatedBlock.moreParams().put(YarnWebParams.APP_OWNER, user);
  aggregatedBlock.moreParams().put("start", "");
  aggregatedBlock.moreParams().put("end", "");
  aggregatedBlock.moreParams().put(YarnWebParams.ENTITY_STRING, "entity");
  return aggregatedBlock;
}
 
Example 11
Source Project: big-c   Source File: RmController.java    License: Apache License 2.0 6 votes vote down vote up
public void scheduler() {
  // limit applications to those in states relevant to scheduling
  set(YarnWebParams.APP_STATE, StringHelper.cjoin(
      YarnApplicationState.NEW.toString(),
      YarnApplicationState.NEW_SAVING.toString(),
      YarnApplicationState.SUBMITTED.toString(),
      YarnApplicationState.ACCEPTED.toString(),
      YarnApplicationState.RUNNING.toString()));

  ResourceManager rm = getInstance(ResourceManager.class);
  ResourceScheduler rs = rm.getResourceScheduler();
  if (rs == null || rs instanceof CapacityScheduler) {
    setTitle("Capacity Scheduler");
    render(CapacitySchedulerPage.class);
    return;
  }
  
  if (rs instanceof FairScheduler) {
    setTitle("Fair Scheduler");
    render(FairSchedulerPage.class);
    return;
  }
  
  setTitle("Default Scheduler");
  render(DefaultSchedulerPage.class);
}
 
Example 12
Source Project: big-c   Source File: AppAttemptPage.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);

  String appAttemptId = $(YarnWebParams.APPLICATION_ATTEMPT_ID);
  set(
    TITLE,
    appAttemptId.isEmpty() ? "Bad request: missing application attempt ID"
        : join("Application Attempt ",
          $(YarnWebParams.APPLICATION_ATTEMPT_ID)));

  set(DATATABLES_ID, "containers");
  set(initID(DATATABLES, "containers"), WebPageUtils.containersTableInit());
  setTableStyles(html, "containers", ".queue {width:6em}", ".ui {width:8em}");

  set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.RM_WEB_UI);
}
 
Example 13
Source Project: big-c   Source File: AppPage.java    License: Apache License 2.0 6 votes vote down vote up
@Override 
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);
  String appId = $(YarnWebParams.APPLICATION_ID);
  set(
    TITLE,
    appId.isEmpty() ? "Bad request: missing application ID" : join(
      "Application ", $(YarnWebParams.APPLICATION_ID)));

  set(DATATABLES_ID, "attempts ResourceRequests");
  set(initID(DATATABLES, "attempts"), WebPageUtils.attemptsTableInit());
  setTableStyles(html, "attempts", ".queue {width:6em}", ".ui {width:8em}");

  setTableStyles(html, "ResourceRequests");

  set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.RM_WEB_UI);
}
 
Example 14
Source Project: big-c   Source File: AppAttemptPage.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);

  String appAttemptId = $(YarnWebParams.APPLICATION_ATTEMPT_ID);
  set(
    TITLE,
    appAttemptId.isEmpty() ? "Bad request: missing application attempt ID"
        : join("Application Attempt ",
          $(YarnWebParams.APPLICATION_ATTEMPT_ID)));

  set(DATATABLES_ID, "containers");
  set(initID(DATATABLES, "containers"), WebPageUtils.containersTableInit());
  setTableStyles(html, "containers", ".queue {width:6em}", ".ui {width:8em}");

  set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.APP_HISTORY_WEB_UI);
}
 
Example 15
Source Project: big-c   Source File: AppPage.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);

  String appId = $(YarnWebParams.APPLICATION_ID);
  set(
    TITLE,
    appId.isEmpty() ? "Bad request: missing application ID" : join(
      "Application ", $(YarnWebParams.APPLICATION_ID)));

  set(DATATABLES_ID, "attempts ResourceRequests");
  set(initID(DATATABLES, "attempts"), WebPageUtils.attemptsTableInit());
  setTableStyles(html, "attempts", ".queue {width:6em}", ".ui {width:8em}");

  setTableStyles(html, "ResourceRequests");

  set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.APP_HISTORY_WEB_UI);
}
 
Example 16
Source Project: big-c   Source File: TestAHSWebApp.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testView() throws Exception {
  Injector injector =
      WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
        mockApplicationHistoryClientService(5, 1, 1));
  AHSView ahsViewInstance = injector.getInstance(AHSView.class);

  ahsViewInstance.render();
  WebAppTests.flushOutput(injector);

  ahsViewInstance.set(YarnWebParams.APP_STATE,
    YarnApplicationState.FAILED.toString());
  ahsViewInstance.render();
  WebAppTests.flushOutput(injector);

  ahsViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
    YarnApplicationState.FAILED.toString(), YarnApplicationState.KILLED));
  ahsViewInstance.render();
  WebAppTests.flushOutput(injector);
}
 
Example 17
Source Project: big-c   Source File: TestAHSWebApp.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testAppAttemptPage() throws Exception {
  Injector injector =
      WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
        mockApplicationHistoryClientService(1, 1, 5));
  AppAttemptPage appAttemptPageInstance =
      injector.getInstance(AppAttemptPage.class);

  appAttemptPageInstance.render();
  WebAppTests.flushOutput(injector);

  appAttemptPageInstance.set(YarnWebParams.APPLICATION_ATTEMPT_ID,
    ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1)
      .toString());
  appAttemptPageInstance.render();
  WebAppTests.flushOutput(injector);
}
 
Example 18
Source Project: big-c   Source File: TestAHSWebApp.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testContainerPage() throws Exception {
  Injector injector =
      WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
        mockApplicationHistoryClientService(1, 1, 1));
  ContainerPage containerPageInstance =
      injector.getInstance(ContainerPage.class);

  containerPageInstance.render();
  WebAppTests.flushOutput(injector);

  containerPageInstance.set(
    YarnWebParams.CONTAINER_ID,
    ContainerId
      .newContainerId(
        ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1),
        1).toString());
  containerPageInstance.render();
  WebAppTests.flushOutput(injector);
}
 
Example 19
Source Project: hadoop   Source File: ContainerPage.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);

  String containerId = $(YarnWebParams.CONTAINER_ID);
  set(TITLE, containerId.isEmpty() ? "Bad request: missing container ID"
      : join("Container ", $(YarnWebParams.CONTAINER_ID)));
}
 
Example 20
Source Project: hadoop   Source File: NodeLabelsPage.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void render(Block html) {
  TBODY<TABLE<Hamlet>> tbody = html.table("#nodelabels").
      thead().
      tr().
      th(".name", "Label Name").
      th(".numOfActiveNMs", "Num Of Active NMs").
      th(".totalResource", "Total Resource").
      _()._().
      tbody();
  
  RMNodeLabelsManager nlm = rm.getRMContext().getNodeLabelManager();
  for (NodeLabel info : nlm.pullRMNodeLabelsInfo()) {
    TR<TBODY<TABLE<Hamlet>>> row =
        tbody.tr().td(
            info.getLabelName().isEmpty() ? "<NO_LABEL>" : info
                .getLabelName());
    int nActiveNMs = info.getNumActiveNMs();
    if (nActiveNMs > 0) {
      row = row.td()
      .a(url("nodes",
          "?" + YarnWebParams.NODE_LABEL + "=" + info.getLabelName()),
          String.valueOf(nActiveNMs))
       ._();
    } else {
      row = row.td(String.valueOf(nActiveNMs));
    }
    row.td(info.getResource().toString())._();
  }
  tbody._()._();
}
 
Example 21
Source Project: hadoop   Source File: TestRMWebApp.java    License: Apache License 2.0 5 votes vote down vote up
@Test public void testView() {
  Injector injector = WebAppTests.createMockInjector(RMContext.class,
      mockRMContext(15, 1, 2, 8*GiB),
      new Module() {
    @Override
    public void configure(Binder binder) {
      try {
        ResourceManager mockRm = mockRm(3, 1, 2, 8*GiB);
        binder.bind(ResourceManager.class).toInstance(mockRm);
        binder.bind(ApplicationBaseProtocol.class)
            .toInstance(mockRm.getClientRMService());
      } catch (IOException e) {
        throw new IllegalStateException(e);
      }
    }
  });
  RmView rmViewInstance = injector.getInstance(RmView.class);
  rmViewInstance.set(YarnWebParams.APP_STATE,
      YarnApplicationState.RUNNING.toString());
  rmViewInstance.render();
  WebAppTests.flushOutput(injector);

  rmViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
      YarnApplicationState.ACCEPTED.toString(),
      YarnApplicationState.RUNNING.toString()));
  rmViewInstance.render();
  WebAppTests.flushOutput(injector);
}
 
Example 22
Source Project: hadoop   Source File: TestRMWebApp.java    License: Apache License 2.0 5 votes vote down vote up
@Test public void testNodesPage() {
  // 10 nodes. Two of each type.
  final RMContext rmContext = mockRMContext(3, 2, 12, 8*GiB);
  Injector injector = WebAppTests.createMockInjector(RMContext.class,
      rmContext,
      new Module() {
    @Override
    public void configure(Binder binder) {
      try {
        binder.bind(ResourceManager.class).toInstance(mockRm(rmContext));
      } catch (IOException e) {
        throw new IllegalStateException(e);
      }
    }
  });

  // All nodes
  NodesPage instance = injector.getInstance(NodesPage.class);
  instance.render();
  WebAppTests.flushOutput(injector);

  // Unhealthy nodes
  instance.moreParams().put(YarnWebParams.NODE_STATE,
    NodeState.UNHEALTHY.toString());
  instance.render();
  WebAppTests.flushOutput(injector);

  // Lost nodes
  instance.moreParams().put(YarnWebParams.NODE_STATE,
    NodeState.LOST.toString());
  instance.render();
  WebAppTests.flushOutput(injector);

}
 
Example 23
Source Project: hadoop   Source File: ContainerPage.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);

  String containerId = $(YarnWebParams.CONTAINER_ID);
  set(TITLE, containerId.isEmpty() ? "Bad request: missing container ID"
      : join("Container ", $(YarnWebParams.CONTAINER_ID)));
}
 
Example 24
Source Project: hadoop   Source File: TestAHSWebApp.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testAppPage() throws Exception {
  Injector injector =
      WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
        mockApplicationHistoryClientService(1, 5, 1));
  AppPage appPageInstance = injector.getInstance(AppPage.class);

  appPageInstance.render();
  WebAppTests.flushOutput(injector);

  appPageInstance.set(YarnWebParams.APPLICATION_ID, ApplicationId
    .newInstance(0, 1).toString());
  appPageInstance.render();
  WebAppTests.flushOutput(injector);
}
 
Example 25
Source Project: big-c   Source File: ContainerPage.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);

  String containerId = $(YarnWebParams.CONTAINER_ID);
  set(TITLE, containerId.isEmpty() ? "Bad request: missing container ID"
      : join("Container ", $(YarnWebParams.CONTAINER_ID)));
}
 
Example 26
Source Project: big-c   Source File: NodeLabelsPage.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void render(Block html) {
  TBODY<TABLE<Hamlet>> tbody = html.table("#nodelabels").
      thead().
      tr().
      th(".name", "Label Name").
      th(".numOfActiveNMs", "Num Of Active NMs").
      th(".totalResource", "Total Resource").
      _()._().
      tbody();
  
  RMNodeLabelsManager nlm = rm.getRMContext().getNodeLabelManager();
  for (NodeLabel info : nlm.pullRMNodeLabelsInfo()) {
    TR<TBODY<TABLE<Hamlet>>> row =
        tbody.tr().td(
            info.getLabelName().isEmpty() ? "<NO_LABEL>" : info
                .getLabelName());
    int nActiveNMs = info.getNumActiveNMs();
    if (nActiveNMs > 0) {
      row = row.td()
      .a(url("nodes",
          "?" + YarnWebParams.NODE_LABEL + "=" + info.getLabelName()),
          String.valueOf(nActiveNMs))
       ._();
    } else {
      row = row.td(String.valueOf(nActiveNMs));
    }
    row.td(info.getResource().toString())._();
  }
  tbody._()._();
}
 
Example 27
Source Project: big-c   Source File: TestRMWebApp.java    License: Apache License 2.0 5 votes vote down vote up
@Test public void testView() {
  Injector injector = WebAppTests.createMockInjector(RMContext.class,
      mockRMContext(15, 1, 2, 8*GiB),
      new Module() {
    @Override
    public void configure(Binder binder) {
      try {
        ResourceManager mockRm = mockRm(3, 1, 2, 8*GiB);
        binder.bind(ResourceManager.class).toInstance(mockRm);
        binder.bind(ApplicationBaseProtocol.class)
            .toInstance(mockRm.getClientRMService());
      } catch (IOException e) {
        throw new IllegalStateException(e);
      }
    }
  });
  RmView rmViewInstance = injector.getInstance(RmView.class);
  rmViewInstance.set(YarnWebParams.APP_STATE,
      YarnApplicationState.RUNNING.toString());
  rmViewInstance.render();
  WebAppTests.flushOutput(injector);

  rmViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
      YarnApplicationState.ACCEPTED.toString(),
      YarnApplicationState.RUNNING.toString()));
  rmViewInstance.render();
  WebAppTests.flushOutput(injector);
}
 
Example 28
Source Project: big-c   Source File: TestRMWebApp.java    License: Apache License 2.0 5 votes vote down vote up
@Test public void testNodesPage() {
  // 10 nodes. Two of each type.
  final RMContext rmContext = mockRMContext(3, 2, 12, 8*GiB);
  Injector injector = WebAppTests.createMockInjector(RMContext.class,
      rmContext,
      new Module() {
    @Override
    public void configure(Binder binder) {
      try {
        binder.bind(ResourceManager.class).toInstance(mockRm(rmContext));
      } catch (IOException e) {
        throw new IllegalStateException(e);
      }
    }
  });

  // All nodes
  NodesPage instance = injector.getInstance(NodesPage.class);
  instance.render();
  WebAppTests.flushOutput(injector);

  // Unhealthy nodes
  instance.moreParams().put(YarnWebParams.NODE_STATE,
    NodeState.UNHEALTHY.toString());
  instance.render();
  WebAppTests.flushOutput(injector);

  // Lost nodes
  instance.moreParams().put(YarnWebParams.NODE_STATE,
    NodeState.LOST.toString());
  instance.render();
  WebAppTests.flushOutput(injector);

}
 
Example 29
Source Project: big-c   Source File: ContainerPage.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void preHead(Page.HTML<_> html) {
  commonPreHead(html);

  String containerId = $(YarnWebParams.CONTAINER_ID);
  set(TITLE, containerId.isEmpty() ? "Bad request: missing container ID"
      : join("Container ", $(YarnWebParams.CONTAINER_ID)));
}
 
Example 30
Source Project: big-c   Source File: TestAHSWebApp.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testAppPage() throws Exception {
  Injector injector =
      WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
        mockApplicationHistoryClientService(1, 5, 1));
  AppPage appPageInstance = injector.getInstance(AppPage.class);

  appPageInstance.render();
  WebAppTests.flushOutput(injector);

  appPageInstance.set(YarnWebParams.APPLICATION_ID, ApplicationId
    .newInstance(0, 1).toString());
  appPageInstance.render();
  WebAppTests.flushOutput(injector);
}