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


Java TaskId.getTaskType方法代码示例

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


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

示例1: containerNeed

import org.apache.hadoop.mapreduce.v2.api.records.TaskId; //导入方法依赖的package包/类
private AtomicInteger containerNeed(TaskId taskID) {
  JobId jobID = taskID.getJobId();
  TaskType taskType = taskID.getTaskType();

  ConcurrentMap<JobId, AtomicInteger> relevantMap
      = taskType == TaskType.MAP ? mapContainerNeeds : reduceContainerNeeds;

  AtomicInteger result = relevantMap.get(jobID);

  if (result == null) {
    relevantMap.putIfAbsent(jobID, new AtomicInteger(0));
    result = relevantMap.get(jobID);
  }

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

示例2: thresholdRuntime

import org.apache.hadoop.mapreduce.v2.api.records.TaskId; //导入方法依赖的package包/类
@Override
public long thresholdRuntime(TaskId taskID) {
  JobId jobID = taskID.getJobId();
  Job job = context.getJob(jobID);

  TaskType type = taskID.getTaskType();

  DataStatistics statistics
      = dataStatisticsForTask(taskID);

  int completedTasksOfType
      = type == TaskType.MAP
          ? job.getCompletedMaps() : job.getCompletedReduces();

  int totalTasksOfType
      = type == TaskType.MAP
          ? job.getTotalMaps() : job.getTotalReduces();

  if (completedTasksOfType < MINIMUM_COMPLETE_NUMBER_TO_SPECULATE
      || (((float)completedTasksOfType) / totalTasksOfType)
            < MINIMUM_COMPLETE_PROPORTION_TO_SPECULATE ) {
    return Long.MAX_VALUE;
  }

  long result =  statistics == null
      ? Long.MAX_VALUE
      : (long)statistics.outlier(slowTaskRelativeTresholds.get(job));
  return result;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:StartEndTimesBase.java

示例3: testTaskIDtoString

import org.apache.hadoop.mapreduce.v2.api.records.TaskId; //导入方法依赖的package包/类
@Test (timeout = 120000)
public void testTaskIDtoString() {
  TaskId tid = RecordFactoryProvider.getRecordFactory(null).newRecordInstance(TaskId.class);
  tid.setJobId(RecordFactoryProvider.getRecordFactory(null).newRecordInstance(JobId.class));
  tid.getJobId().setAppId(ApplicationId.newInstance(0, 0));
  tid.setTaskType(TaskType.MAP);
  TaskType type = tid.getTaskType();
  System.err.println(type);
  type = TaskType.REDUCE;
  System.err.println(type);
  System.err.println(tid.getTaskType());
  assertEquals("task_0_0000_m_000000", MRApps.toString(tid));
  tid.setTaskType(TaskType.REDUCE);
  assertEquals("task_0_0000_r_000000", MRApps.toString(tid));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestMRApps.java

示例4: attemptsTableInit

import org.apache.hadoop.mapreduce.v2.api.records.TaskId; //导入方法依赖的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

示例5: newTask

import org.apache.hadoop.mapreduce.v2.api.records.TaskId; //导入方法依赖的package包/类
public static Task newTask(JobId jid, int i, int m, final boolean hasFailedTasks) {
  final TaskId tid = Records.newRecord(TaskId.class);
  tid.setJobId(jid);
  tid.setId(i);
  tid.setTaskType(TASK_TYPES.next());
  final TaskReport report = newTaskReport(tid);
  final Map<TaskAttemptId, TaskAttempt> attempts = newTaskAttempts(tid, m);
  return new Task() {
    @Override
    public TaskId getID() {
      return tid;
    }

    @Override
    public TaskReport getReport() {
      return report;
    }

    @Override
    public Counters getCounters() {
      if (hasFailedTasks) {
        return null;
      }
      return new Counters(
        TypeConverter.fromYarn(report.getCounters()));
    }

    @Override
    public float getProgress() {
      return report.getProgress();
    }

    @Override
    public TaskType getType() {
      return tid.getTaskType();
    }

    @Override
    public Map<TaskAttemptId, TaskAttempt> getAttempts() {
      return attempts;
    }

    @Override
    public TaskAttempt getAttempt(TaskAttemptId attemptID) {
      return attempts.get(attemptID);
    }

    @Override
    public boolean isFinished() {
      switch (report.getTaskState()) {
      case SUCCEEDED:
      case KILLED:
      case FAILED:
        return true;
      }
      return false;
    }

    @Override
    public boolean canCommit(TaskAttemptId taskAttemptID) {
      return false;
    }

    @Override
    public TaskState getState() {
      return report.getTaskState();
    }
  };
}
 
开发者ID:naver,项目名称:hadoop,代码行数:70,代码来源:MockJobs.java


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