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


Java MRApps.toTaskID方法代码示例

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


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

示例1: testSingleTaskCounterView

import org.apache.hadoop.mapreduce.v2.util.MRApps; //导入方法依赖的package包/类
@Test public void testSingleTaskCounterView() {
  AppContext appContext = new MockAppContext(0, 1, 1, 2);
  Map<String, String> params = getTaskParams(appContext);
  params.put(AMParams.COUNTER_GROUP, 
      "org.apache.hadoop.mapreduce.FileSystemCounter");
  params.put(AMParams.COUNTER_NAME, "HDFS_WRITE_OPS");
  
  // remove counters from one task attempt
  // to test handling of missing counters
  TaskId taskID = MRApps.toTaskID(params.get(AMParams.TASK_ID));
  Job job = appContext.getJob(taskID.getJobId());
  Task task = job.getTask(taskID);
  TaskAttempt attempt = task.getAttempts().values().iterator().next();
  attempt.getReport().setCounters(null);
  
  WebAppTests.testPage(SingleCounterPage.class, AppContext.class,
                       appContext, params);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestAMWebApp.java

示例2: getSingleTaskCounters

import org.apache.hadoop.mapreduce.v2.util.MRApps; //导入方法依赖的package包/类
@GET
@Path("/mapreduce/jobs/{jobid}/tasks/{taskid}/counters")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public JobTaskCounterInfo getSingleTaskCounters(
    @Context HttpServletRequest hsr, @PathParam("jobid") String jid,
    @PathParam("taskid") String tid) {

  init();
  Job job = AMWebServices.getJobFromJobIdString(jid, ctx);
  checkAccess(job, hsr);
  TaskId taskID = MRApps.toTaskID(tid);
  if (taskID == null) {
    throw new NotFoundException("taskid " + tid + " not found or invalid");
  }
  Task task = job.getTask(taskID);
  if (task == null) {
    throw new NotFoundException("task not found with id " + tid);
  }
  return new JobTaskCounterInfo(task);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:HsWebServices.java

示例3: requireTask

import org.apache.hadoop.mapreduce.v2.util.MRApps; //导入方法依赖的package包/类
/**
 * Ensure that a TASK_ID was passed into the page.
 */
public void requireTask() {
  if ($(TASK_ID).isEmpty()) {
    badRequest("missing task ID");
    throw new RuntimeException("missing task ID");
  }

  TaskId taskID = MRApps.toTaskID($(TASK_ID));
  Job job = app.context.getJob(taskID.getJobId());
  app.setJob(job);
  if (app.getJob() == null) {
    notFound(MRApps.toString(taskID.getJobId()));
    throw new RuntimeException("Not Found: " + $(JOB_ID));
  } else {
    app.setTask(app.getJob().getTask(taskID));
    if (app.getTask() == null) {
      notFound($(TASK_ID));
      throw new RuntimeException("Not Found: " + $(TASK_ID));
    }
  }
  if (!checkAccess(job)) {
    accessDenied("User " + request().getRemoteUser() + " does not have " +
        " permission to view job " + $(JOB_ID));
    throw new RuntimeException("Access denied: User " +
        request().getRemoteUser() + " does not have permission to view job " +
        $(JOB_ID));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:AppController.java

示例4: attemptsTableInit

import org.apache.hadoop.mapreduce.v2.util.MRApps; //导入方法依赖的package包/类
/**
 * @return The end of the JS map that is the jquery datatable config for the
 * attempts table. 
 */
private String attemptsTableInit() {
  TaskType type = null;
  String symbol = $(TASK_TYPE);
  if (!symbol.isEmpty()) {
    type = MRApps.taskType(symbol);
  } else {
    TaskId taskID = MRApps.toTaskID($(TASK_ID));
    type = taskID.getTaskType();
  }
  StringBuilder b = tableInit()
    .append(", 'aaData': attemptsTableData")
    .append(", bDeferRender: true")
    .append(", bProcessing: true")
    .append("\n,aoColumnDefs:[\n")

    //logs column should not filterable (it includes container ID which may pollute searches)
    .append("\n{'aTargets': [ 4 ]")
    .append(", 'bSearchable': false }")

    .append("\n, {'sType':'numeric', 'aTargets': [ 0 ]")
    .append(", 'mRender': parseHadoopAttemptID }")

    .append("\n, {'sType':'numeric', 'aTargets': [ 5, 6")
    //Column numbers are different for maps and reduces
    .append(type == TaskType.REDUCE ? ", 7, 8" : "")
    .append(" ], 'mRender': renderHadoopDate }")

    .append("\n, {'sType':'numeric', 'aTargets': [")
    .append(type == TaskType.REDUCE ? "9, 10, 11, 12" : "7")
    .append(" ], 'mRender': renderHadoopElapsedTime }]")

    // Sort by id upon page load
    .append("\n, aaSorting: [[0, 'asc']]")
    .append("}");
    return b.toString();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:41,代码来源:HsTaskPage.java


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