Java Code Examples for org.apache.hadoop.mapreduce.JobStatus#State

The following examples show how to use org.apache.hadoop.mapreduce.JobStatus#State . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentPump.java    From marklogic-contentpump with Apache License 2.0 6 votes vote down vote up
public static int getReturnCode(JobStatus.State state) {
    switch (state) {
        case RUNNING:
            return -1;
        case SUCCEEDED:
            return 0;
        case FAILED:
            return 1;
        case PREP:
            return 2;
        case KILLED:
            return 3;
        default:
            return 4;
    }
}
 
Example 2
Source File: BoaOutputCommitter.java    From compiler with Apache License 2.0 6 votes vote down vote up
@Override
public void abortJob(final JobContext context, final JobStatus.State runState) throws java.io.IOException {
	super.abortJob(context, runState);

	final JobClient jobClient = new JobClient(new JobConf(context.getConfiguration()));
	final RunningJob job = jobClient.getJob((org.apache.hadoop.mapred.JobID) JobID.forName(context.getConfiguration().get("mapred.job.id")));
	String diag = "";
	for (final TaskCompletionEvent event : job.getTaskCompletionEvents(0))
		switch (event.getTaskStatus()) {
			case SUCCEEDED:
				break;
			default:
				diag += "Diagnostics for: " + event.getTaskTrackerHttp() + "\n";
				for (final String s : job.getTaskDiagnostics(event.getTaskAttemptId()))
					diag += s + "\n";
				diag += "\n";
				break;
		}
	updateStatus(diag, context.getConfiguration().getInt("boa.hadoop.jobid", 0));
}
 
Example 3
Source File: MROutputCommitter.java    From tez with Apache License 2.0 6 votes vote down vote up
private JobStatus.State getJobStateFromVertexStatusState(VertexStatus.State state) {
  switch(state) {
    case INITED:
      return JobStatus.State.PREP;
    case RUNNING:
      return JobStatus.State.RUNNING;
    case SUCCEEDED:
      return JobStatus.State.SUCCEEDED;
    case KILLED:
      return JobStatus.State.KILLED;
    case FAILED:
    case ERROR:
      return JobStatus.State.FAILED;
    default:
      throw new TezUncheckedException("Unknown VertexStatus.State: " + state);
  }
}
 
Example 4
Source File: CommitterJobAbortEvent.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public CommitterJobAbortEvent(JobId jobID, JobContext jobContext,
    JobStatus.State finalState) {
  super(CommitterEventType.JOB_ABORT);
  this.jobID = jobID;
  this.jobContext = jobContext;
  this.finalState = finalState;
}
 
Example 5
Source File: TestJobOutputCommitter.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void abortJob(JobContext context, JobStatus.State state)
    throws IOException {
  Path outputPath = FileOutputFormat.getOutputPath(context);
  FileSystem fs = outputPath.getFileSystem(context.getConfiguration());
  String fileName = 
    (state.equals(JobStatus.State.FAILED)) ? ABORT_FAILED_FILE_NAME
      : ABORT_KILLED_FILE_NAME;
  fs.create(new Path(outputPath, fileName)).close();
}
 
Example 6
Source File: TestJobOutputCommitter.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public void abortJob(JobContext context, JobStatus.State state)
    throws IOException {
  Path outputPath = FileOutputFormat.getOutputPath(context);
  FileSystem fs = outputPath.getFileSystem(context.getConfiguration());
  String fileName = 
    (state.equals(JobStatus.State.FAILED)) ? ABORT_FAILED_FILE_NAME
      : ABORT_KILLED_FILE_NAME;
  fs.create(new Path(outputPath, fileName)).close();
}
 
Example 7
Source File: FileOutputCommitter.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Delete the temporary directory, including all of the work directories.
 * @param context the job's context
 */
@Override
public void abortJob(JobContext context, JobStatus.State state) 
throws IOException {
  // delete the _temporary folder
  cleanupJob(context);
}
 
Example 8
Source File: MROutputCommitter.java    From tez with Apache License 2.0 5 votes vote down vote up
@Override
public void abortOutput(VertexStatus.State finalState) throws IOException {
  if (!initialized) {
    throw new RuntimeException("Committer not initialized");
  }
  JobStatus.State jobState = getJobStateFromVertexStatusState(finalState);
  committer.abortJob(jobContext, jobState);
}
 
Example 9
Source File: CopyCommitter.java    From circus-train with Apache License 2.0 5 votes vote down vote up
/** @inheritDoc */
@Override
public void abortJob(JobContext jobContext, JobStatus.State state) throws IOException {
  try {
    super.abortJob(jobContext, state);
  } finally {
    cleanup(jobContext.getConfiguration());
  }
}
 
Example 10
Source File: MROutputCommitter.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
@Override
public void abortOutput(VertexStatus.State finalState) throws IOException {
  if (!initialized) {
    throw new RuntimeException("Committer not initialized");
  }
  JobStatus.State jobState = getJobStateFromVertexStatusState(finalState);
  committer.abortJob(jobContext, jobState);
}
 
Example 11
Source File: CommitterJobAbortEvent.java    From big-c with Apache License 2.0 5 votes vote down vote up
public CommitterJobAbortEvent(JobId jobID, JobContext jobContext,
    JobStatus.State finalState) {
  super(CommitterEventType.JOB_ABORT);
  this.jobID = jobID;
  this.jobContext = jobContext;
  this.finalState = finalState;
}
 
Example 12
Source File: LocalJob.java    From marklogic-contentpump with Apache License 2.0 4 votes vote down vote up
@Override
public JobStatus.State getJobState() {
    return state;
}
 
Example 13
Source File: JobAbortCompletedEvent.java    From big-c with Apache License 2.0 4 votes vote down vote up
public JobStatus.State getFinalState() {
  return finalState;
}
 
Example 14
Source File: SqoopOutputCommitter.java    From sqoop-on-spark with Apache License 2.0 4 votes vote down vote up
@Override
public void abortJob(JobContext jobContext, JobStatus.State state) throws IOException {
  super.abortJob(jobContext, state);
  invokeDestroyerExecutor(jobContext, false);
}
 
Example 15
Source File: CommitterJobAbortEvent.java    From big-c with Apache License 2.0 4 votes vote down vote up
public JobStatus.State getFinalState() {
  return finalState;
}
 
Example 16
Source File: CleanupTempTableOutputCommitter.java    From clickhouse-hdfs-loader with MIT License 4 votes vote down vote up
@Override
public void abortJob(JobContext jobContext, JobStatus.State state) throws IOException {
    logger.info("Abort job for id="+jobContext.getJobID().toString());
    super.abortJob(jobContext, state);
}
 
Example 17
Source File: DatasetKeyOutputFormat.java    From kite with Apache License 2.0 4 votes vote down vote up
@Override
public void abortJob(JobContext jobContext, JobStatus.State state) {
  deleteJobDataset(jobContext);
}
 
Example 18
Source File: Task.java    From RDFS with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the task to do job abort in the cleanup.
 * @param status the final runstate of the job 
 */
void setJobCleanupTaskState(JobStatus.State status) {
  jobRunStateForCleanup = status;
}
 
Example 19
Source File: Task.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the task to do job abort in the cleanup.
 * @param status the final runstate of the job. 
 */
void setJobCleanupTaskState(JobStatus.State status) {
  jobRunStateForCleanup = status;
}
 
Example 20
Source File: Task.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the task to do job abort in the cleanup.
 * @param status the final runstate of the job. 
 */
void setJobCleanupTaskState(JobStatus.State status) {
  jobRunStateForCleanup = status;
}