com.twitter.ambrose.model.hadoop.MapReduceJobState Maven / Gradle / Ivy
package com.twitter.ambrose.model.hadoop;
import com.fasterxml.jackson.annotation.JsonCreator;
import org.apache.hadoop.mapred.RunningJob;
import org.apache.hadoop.mapred.TaskReport;
import java.io.IOException;
/**
* Container that holds state of a MapReduce job
*/
public class MapReduceJobState {
private String jobId;
private String jobName;
private String trackingURL;
private boolean isComplete;
private boolean isSuccessful;
private float mapProgress;
private float reduceProgress;
private int totalMappers;
private int totalReducers;
@JsonCreator
public MapReduceJobState() { }
@SuppressWarnings("deprecation")
public MapReduceJobState(RunningJob runningJob,
TaskReport[] mapTaskReport,
TaskReport[] reduceTaskReport) throws IOException {
jobId = runningJob.getID().toString();
jobName = runningJob.getJobName();
trackingURL = runningJob.getTrackingURL();
isComplete = runningJob.isComplete();
isSuccessful = runningJob.isSuccessful();
mapProgress = runningJob.mapProgress();
reduceProgress = runningJob.reduceProgress();
totalMappers = mapTaskReport.length;
totalReducers = reduceTaskReport.length;
}
public String getJobId() {
return jobId;
}
public void setJobId(String jobId) {
this.jobId = jobId;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public String getTrackingURL() {
return trackingURL;
}
public void setTrackingURL(String trackingURL) {
this.trackingURL = trackingURL;
}
public boolean isComplete() {
return isComplete;
}
public void setComplete(boolean complete) {
isComplete = complete;
}
public boolean isSuccessful() {
return isSuccessful;
}
public void setSuccessful(boolean successful) {
isSuccessful = successful;
}
public float getMapProgress() {
return mapProgress;
}
public void setMapProgress(float mapProgress) {
this.mapProgress = mapProgress;
}
public float getReduceProgress() {
return reduceProgress;
}
public void setReduceProgress(float reduceProgress) {
this.reduceProgress = reduceProgress;
}
public int getTotalMappers() {
return totalMappers;
}
public void setTotalMappers(int totalMappers) {
this.totalMappers = totalMappers;
}
public int getTotalReducers() {
return totalReducers;
}
public void setTotalReducers(int totalReducers) {
this.totalReducers = totalReducers;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy