private GetJobReportResponse getJobReportResponse() {
   GetJobReportResponse jobReportResponse = Records.newRecord(GetJobReportResponse.class);
   JobReport jobReport = Records.newRecord(JobReport.class);
   jobReport.setJobId(jobId);
   jobReport.setJobState(JobState.SUCCEEDED);
   jobReportResponse.setJobReport(jobReport);
   return jobReportResponse;
 }
Exemple #2
0
 public PartialJob(JobIndexInfo jobIndexInfo, JobId jobId) {
   this.jobIndexInfo = jobIndexInfo;
   this.jobId = jobId;
   jobReport = RecordFactoryProvider.getRecordFactory(null).newRecordInstance(JobReport.class);
   jobReport.setSubmitTime(jobIndexInfo.getSubmitTime());
   jobReport.setStartTime(jobIndexInfo.getJobStartTime());
   jobReport.setFinishTime(jobIndexInfo.getFinishTime());
   jobReport.setJobState(getState());
 }
 private GetJobReportResponse getJobReportResponseFromHistoryServer() {
   GetJobReportResponse jobReportResponse = Records.newRecord(GetJobReportResponse.class);
   JobReport jobReport = Records.newRecord(JobReport.class);
   jobReport.setJobId(jobId);
   jobReport.setJobState(JobState.SUCCEEDED);
   jobReport.setMapProgress(1.0f);
   jobReport.setReduceProgress(1.0f);
   jobReport.setJobFile("TestJobFilePath");
   jobReport.setTrackingUrl("http://TestTrackingUrl");
   jobReportResponse.setJobReport(jobReport);
   return jobReportResponse;
 }
Exemple #4
0
  public JobInfo(Job job, Boolean hasAccess) {
    this.id = MRApps.toString(job.getID());
    JobReport report = job.getReport();
    this.startTime = report.getStartTime();
    this.finishTime = report.getFinishTime();
    this.elapsedTime = Times.elapsed(this.startTime, this.finishTime);
    if (this.elapsedTime == -1) {
      this.elapsedTime = 0;
    }
    this.name = job.getName().toString();
    this.user = job.getUserName();
    this.queue = job.getQueueName();
    this.state = job.getState();
    this.mapsTotal = job.getTotalMaps();
    this.mapsCompleted = job.getCompletedMaps();
    this.mapProgress = report.getMapProgress() * 100;
    this.mapProgressPercent = StringUtils.formatPercent(report.getMapProgress(), 2);
    this.reducesTotal = job.getTotalReduces();
    this.reducesCompleted = job.getCompletedReduces();
    this.reduceProgress = report.getReduceProgress() * 100;
    this.reduceProgressPercent = StringUtils.formatPercent(report.getReduceProgress(), 2);

    this.acls = new ArrayList<ConfEntryInfo>();
    if (hasAccess) {
      this.diagnostics = "";
      countTasksAndAttempts(job);

      this.uberized = job.isUber();

      List<String> diagnostics = job.getDiagnostics();
      if (diagnostics != null && !diagnostics.isEmpty()) {
        StringBuffer b = new StringBuffer();
        for (String diag : diagnostics) {
          b.append(diag);
        }
        this.diagnostics = b.toString();
      }

      Map<JobACL, AccessControlList> allacls = job.getJobACLs();
      if (allacls != null) {
        for (Map.Entry<JobACL, AccessControlList> entry : allacls.entrySet()) {
          this.acls.add(
              new ConfEntryInfo(entry.getKey().getAclName(), entry.getValue().getAclString()));
        }
      }
    }
  }
    @Override
    public GetJobReportResponse getJobReport(GetJobReportRequest request) throws IOException {

      amContact = true;

      JobReport jobReport = recordFactory.newRecordInstance(JobReport.class);
      jobReport.setJobId(request.getJobId());
      jobReport.setJobState(JobState.RUNNING);
      jobReport.setJobName("TestClientRedirect-jobname");
      jobReport.setUser("TestClientRedirect-user");
      jobReport.setStartTime(0L);
      jobReport.setFinishTime(1L);

      GetJobReportResponse response = recordFactory.newRecordInstance(GetJobReportResponse.class);
      response.setJobReport(jobReport);
      return response;
    }