类org.apache.hadoop.mapreduce.v2.hs.HistoryContext源码实例Demo

下面列出了怎么用org.apache.hadoop.mapreduce.v2.hs.HistoryContext的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: hadoop   文件: TestHsWebServicesAttempts.java
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
源代码2 项目: hadoop   文件: TestHsWebServices.java
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 1, 1);
  JobHistory jobHistoryService = new JobHistory();
  HistoryContext historyContext = (HistoryContext) jobHistoryService;
  webApp = new HsWebApp(historyContext);

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
源代码3 项目: hadoop   文件: TestHsWebServicesJobs.java
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1, false);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
源代码4 项目: hadoop   文件: TestHsWebServicesJobsQuery.java
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(3, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
源代码5 项目: hadoop   文件: TestHsWebServicesTasks.java
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
源代码6 项目: big-c   文件: TestHsWebServicesAttempts.java
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
源代码7 项目: big-c   文件: TestHsWebServices.java
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 1, 1);
  JobHistory jobHistoryService = new JobHistory();
  HistoryContext historyContext = (HistoryContext) jobHistoryService;
  webApp = new HsWebApp(historyContext);

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
源代码8 项目: big-c   文件: TestHsWebServicesJobs.java
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1, false);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
源代码9 项目: big-c   文件: TestHsWebServicesJobsQuery.java
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(3, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
源代码10 项目: big-c   文件: TestHsWebServicesTasks.java
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
源代码11 项目: XLearning   文件: HistoryClientService.java
public HistoryClientService(HistoryContext history,
                            JHSDelegationTokenSecretManager jhsDTSecretManager) {
  super("HistoryClientService");
  this.history = history;
  this.protocolHandler = new HSClientProtocolHandler();
  this.jhsDTSecretManager = jhsDTSecretManager;
}
 
源代码12 项目: XLearning   文件: JobHistoryServer.java
@Override
protected void serviceInit(Configuration conf) throws Exception {
  Configuration config = new XLearningConfiguration(conf);

  config.setBoolean(Dispatcher.DISPATCHER_EXIT_ON_ERROR_KEY, true);

  // This is required for WebApps to use https if enabled.
  XLearningWebAppUtil.initialize(getConfig());

  try {
    doSecureLogin(conf);
  } catch (IOException ie) {
    throw new YarnRuntimeException("History Server Failed to login", ie);
  }

  jobHistoryService = new JobHistory();
  historyContext = (HistoryContext) jobHistoryService;
  stateStore = createStateStore(conf);
  this.jhsDTSecretManager = createJHSSecretManager(conf, stateStore);
  clientService = createHistoryClientService();
  aggLogDelService = new AggregatedLogDeletionService();

  addService(stateStore);
  addService(new HistoryServerSecretManagerService());
  addService(clientService);
  addService(aggLogDelService);
  super.serviceInit(config);
}
 
源代码13 项目: XLearning   文件: HsWebApp.java
@Override
public void setup() {
  bind(HsWebServices.class);
  bind(JAXBContextResolver.class);
  bind(GenericExceptionHandler.class);
  bind(AppContext.class).toInstance(history);
  bind(HistoryContext.class).toInstance(history);
  route("/", HsController.class);
  route(pajoin("/job", APP_ID), HsController.class, "job");
  route(pajoin("/logs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER,
      CONTAINER_LOG_TYPE), HsController.class, "logs");
}
 
源代码14 项目: hadoop   文件: HsWebApp.java
@Override
public void setup() {
  bind(HsWebServices.class);
  bind(JAXBContextResolver.class);
  bind(GenericExceptionHandler.class);
  bind(AppContext.class).toInstance(history);
  bind(HistoryContext.class).toInstance(history);
  route("/", HsController.class);
  route("/app", HsController.class);
  route(pajoin("/job", JOB_ID), HsController.class, "job");
  route(pajoin("/conf", JOB_ID), HsController.class, "conf");
  route(pajoin("/jobcounters", JOB_ID), HsController.class, "jobCounters");
  route(pajoin("/singlejobcounter",JOB_ID, COUNTER_GROUP, COUNTER_NAME),
      HsController.class, "singleJobCounter");
  route(pajoin("/tasks", JOB_ID, TASK_TYPE), HsController.class, "tasks");
  route(pajoin("/attempts", JOB_ID, TASK_TYPE, ATTEMPT_STATE),
      HsController.class, "attempts");
  route(pajoin("/task", TASK_ID), HsController.class, "task");
  route(pajoin("/taskcounters", TASK_ID), HsController.class, "taskCounters");
  route(pajoin("/singletaskcounter",TASK_ID, COUNTER_GROUP, COUNTER_NAME),
      HsController.class, "singleTaskCounter");
  route("/about", HsController.class, "about");
  route(pajoin("/logs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER,
      CONTAINER_LOG_TYPE), HsController.class, "logs");
  route(pajoin("/nmlogs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER,
      CONTAINER_LOG_TYPE), HsController.class, "nmlogs");
}
 
源代码15 项目: hadoop   文件: TestHsWebServicesAcls.java
private static HistoryContext buildHistoryContext(final Configuration conf)
    throws IOException {
  HistoryContext ctx = new MockHistoryContext(1, 1, 1);
  Map<JobId, Job> jobs = ctx.getAllJobs();
  JobId jobId = jobs.keySet().iterator().next();
  Job mockJob = new MockJobForAcls(jobs.get(jobId), conf);
  jobs.put(jobId, mockJob);
  return ctx;
}
 
源代码16 项目: hadoop   文件: TestHsWebServicesJobs.java
@Test
public void testJobCountersForKilledJob() throws Exception {
  WebResource r = resource();
  appContext = new MockHistoryContext(0, 1, 1, 1, true);
  injector = Guice.createInjector(new ServletModule() {
    @Override
    protected void configureServlets() {

      webApp = mock(HsWebApp.class);
      when(webApp.name()).thenReturn("hsmockwebapp");

      bind(JAXBContextResolver.class);
      bind(HsWebServices.class);
      bind(GenericExceptionHandler.class);
      bind(WebApp.class).toInstance(webApp);
      bind(AppContext.class).toInstance(appContext);
      bind(HistoryContext.class).toInstance(appContext);
      bind(Configuration.class).toInstance(conf);

      serve("/*").with(GuiceContainer.class);
    }
  });
  
  Map<JobId, Job> jobsMap = appContext.getAllJobs();
  for (JobId id : jobsMap.keySet()) {
    String jobId = MRApps.toString(id);

    ClientResponse response = r.path("ws").path("v1").path("history")
        .path("mapreduce").path("jobs").path(jobId).path("counters/")
        .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject json = response.getEntity(JSONObject.class);
    assertEquals("incorrect number of elements", 1, json.length());
    JSONObject info = json.getJSONObject("jobCounters");
    WebServicesTestUtils.checkStringMatch("id", MRApps.toString(id),
        info.getString("id"));
    assertTrue("Job shouldn't contain any counters", info.length() == 1);
  }
}
 
源代码17 项目: big-c   文件: HsWebApp.java
@Override
public void setup() {
  bind(HsWebServices.class);
  bind(JAXBContextResolver.class);
  bind(GenericExceptionHandler.class);
  bind(AppContext.class).toInstance(history);
  bind(HistoryContext.class).toInstance(history);
  route("/", HsController.class);
  route("/app", HsController.class);
  route(pajoin("/job", JOB_ID), HsController.class, "job");
  route(pajoin("/conf", JOB_ID), HsController.class, "conf");
  route(pajoin("/jobcounters", JOB_ID), HsController.class, "jobCounters");
  route(pajoin("/singlejobcounter",JOB_ID, COUNTER_GROUP, COUNTER_NAME),
      HsController.class, "singleJobCounter");
  route(pajoin("/tasks", JOB_ID, TASK_TYPE), HsController.class, "tasks");
  route(pajoin("/attempts", JOB_ID, TASK_TYPE, ATTEMPT_STATE),
      HsController.class, "attempts");
  route(pajoin("/task", TASK_ID), HsController.class, "task");
  route(pajoin("/taskcounters", TASK_ID), HsController.class, "taskCounters");
  route(pajoin("/singletaskcounter",TASK_ID, COUNTER_GROUP, COUNTER_NAME),
      HsController.class, "singleTaskCounter");
  route("/about", HsController.class, "about");
  route(pajoin("/logs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER,
      CONTAINER_LOG_TYPE), HsController.class, "logs");
  route(pajoin("/nmlogs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER,
      CONTAINER_LOG_TYPE), HsController.class, "nmlogs");
}
 
源代码18 项目: big-c   文件: TestHsWebServicesAcls.java
private static HistoryContext buildHistoryContext(final Configuration conf)
    throws IOException {
  HistoryContext ctx = new MockHistoryContext(1, 1, 1);
  Map<JobId, Job> jobs = ctx.getAllJobs();
  JobId jobId = jobs.keySet().iterator().next();
  Job mockJob = new MockJobForAcls(jobs.get(jobId), conf);
  jobs.put(jobId, mockJob);
  return ctx;
}
 
源代码19 项目: big-c   文件: TestHsWebServicesJobs.java
@Test
public void testJobCountersForKilledJob() throws Exception {
  WebResource r = resource();
  appContext = new MockHistoryContext(0, 1, 1, 1, true);
  injector = Guice.createInjector(new ServletModule() {
    @Override
    protected void configureServlets() {

      webApp = mock(HsWebApp.class);
      when(webApp.name()).thenReturn("hsmockwebapp");

      bind(JAXBContextResolver.class);
      bind(HsWebServices.class);
      bind(GenericExceptionHandler.class);
      bind(WebApp.class).toInstance(webApp);
      bind(AppContext.class).toInstance(appContext);
      bind(HistoryContext.class).toInstance(appContext);
      bind(Configuration.class).toInstance(conf);

      serve("/*").with(GuiceContainer.class);
    }
  });
  
  Map<JobId, Job> jobsMap = appContext.getAllJobs();
  for (JobId id : jobsMap.keySet()) {
    String jobId = MRApps.toString(id);

    ClientResponse response = r.path("ws").path("v1").path("history")
        .path("mapreduce").path("jobs").path(jobId).path("counters/")
        .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject json = response.getEntity(JSONObject.class);
    assertEquals("incorrect number of elements", 1, json.length());
    JSONObject info = json.getJSONObject("jobCounters");
    WebServicesTestUtils.checkStringMatch("id", MRApps.toString(id),
        info.getString("id"));
    assertTrue("Job shouldn't contain any counters", info.length() == 1);
  }
}
 
源代码20 项目: XLearning   文件: HsWebApp.java
public HsWebApp(HistoryContext history) {
  this.history = history;
}
 
源代码21 项目: hadoop   文件: HsWebServices.java
@Inject
public HsWebServices(final HistoryContext ctx, final Configuration conf,
    final WebApp webapp) {
  this.ctx = ctx;
  this.webapp = webapp;
}
 
源代码22 项目: hadoop   文件: HsWebApp.java
public HsWebApp(HistoryContext history) {
  this.history = history;
}
 
源代码23 项目: hadoop   文件: TestHsWebServicesJobConf.java
@Override
protected void configureServlets() {

  Path confPath = new Path(testConfDir.toString(),
      MRJobConfig.JOB_CONF_FILE);
  Configuration config = new Configuration();

  FileSystem localFs;
  try {
    localFs = FileSystem.getLocal(config);
    confPath = localFs.makeQualified(confPath);

    OutputStream out = localFs.create(confPath);
    try {
      conf.writeXml(out);
    } finally {
      out.close();
    }
    if (!localFs.exists(confPath)) {
      fail("error creating config file: " + confPath);
    }

  } catch (IOException e) {
    fail("error creating config file: " + e.getMessage());
  }

  appContext = new MockHistoryContext(0, 2, 1, confPath);

  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
源代码24 项目: big-c   文件: HsWebServices.java
@Inject
public HsWebServices(final HistoryContext ctx, final Configuration conf,
    final WebApp webapp) {
  this.ctx = ctx;
  this.webapp = webapp;
}
 
源代码25 项目: big-c   文件: HsWebApp.java
public HsWebApp(HistoryContext history) {
  this.history = history;
}
 
源代码26 项目: big-c   文件: TestHsWebServicesJobConf.java
@Override
protected void configureServlets() {

  Path confPath = new Path(testConfDir.toString(),
      MRJobConfig.JOB_CONF_FILE);
  Configuration config = new Configuration();

  FileSystem localFs;
  try {
    localFs = FileSystem.getLocal(config);
    confPath = localFs.makeQualified(confPath);

    OutputStream out = localFs.create(confPath);
    try {
      conf.writeXml(out);
    } finally {
      out.close();
    }
    if (!localFs.exists(confPath)) {
      fail("error creating config file: " + confPath);
    }

  } catch (IOException e) {
    fail("error creating config file: " + e.getMessage());
  }

  appContext = new MockHistoryContext(0, 2, 1, confPath);

  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
 同包方法