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


Java TaskReport.getTaskState方法代码示例

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


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

示例1: TaskInfo

import org.apache.hadoop.mapreduce.v2.api.records.TaskReport; //导入方法依赖的package包/类
public TaskInfo(Task task) {
  TaskType ttype = task.getType();
  this.type = ttype.toString();
  TaskReport report = task.getReport();
  this.startTime = report.getStartTime();
  this.finishTime = report.getFinishTime();
  this.state = report.getTaskState();
  this.elapsedTime = Times.elapsed(this.startTime, this.finishTime,
    this.state == TaskState.RUNNING);
  if (this.elapsedTime == -1) {
    this.elapsedTime = 0;
  }
  this.progress = report.getProgress() * 100;
  this.status =  report.getStatus();
  this.id = MRApps.toString(task.getID());
  this.taskNum = task.getID().getId();
  this.successful = getSuccessfulAttempt(task);
  if (successful != null) {
    this.successfulAttempt = MRApps.toString(successful.getID());
  } else {
    this.successfulAttempt = "";
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TaskInfo.java

示例2: TaskInfo

import org.apache.hadoop.mapreduce.v2.api.records.TaskReport; //导入方法依赖的package包/类
public TaskInfo(Task task) {
  TaskType ttype = task.getType();
  this.type = ttype.toString();
  TaskReport report = task.getReport();
  this.startTime = report.getStartTime();
  this.finishTime = report.getFinishTime();
  this.state = report.getTaskState();
  this.elapsedTime = Times.elapsed(this.startTime, this.finishTime,
    this.state == TaskState.RUNNING);
  if (this.elapsedTime == -1) {
    this.elapsedTime = 0;
  }
  this.progress = report.getProgress() * 100;
  this.id = MRApps.toString(task.getID());
  this.taskNum = task.getID().getId();
  this.successful = getSuccessfulAttempt(task);
  if (successful != null) {
    this.successfulAttempt = MRApps.toString(successful.getID());
  } else {
    this.successfulAttempt = "";
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:23,代码来源:TaskInfo.java

示例3: newTask

import org.apache.hadoop.mapreduce.v2.api.records.TaskReport; //导入方法依赖的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.TaskReport.getTaskState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。