Skip to content

Commit

Permalink
Delegate all remaining methods of output committer
Browse files Browse the repository at this point in the history
  • Loading branch information
itsankit-google committed Oct 21, 2024
1 parent 1013fbe commit aeff034
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

package io.cdap.cdap.etl.spark.io;

import io.cdap.cdap.etl.api.exception.ErrorDetailsProvider;
import io.cdap.cdap.etl.api.exception.ErrorPhase;
import io.cdap.cdap.etl.common.ErrorDetails;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.JobStatus.State;
import org.apache.hadoop.mapreduce.OutputCommitter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;

Expand Down Expand Up @@ -59,6 +57,37 @@ public void setupJob(JobContext jobContext) {
}
}

@Override
@Deprecated
public void cleanupJob(JobContext jobContext) {
try {
delegate.cleanupJob(jobContext);
} catch (Exception e) {
throw ErrorDetails.handleException(e, stageName, errorDetailsProvider,
ErrorPhase.COMMITTING);
}
}

@Override
public void commitJob(JobContext jobContext) {
try {
delegate.commitJob(jobContext);
} catch (Exception e) {
throw ErrorDetails.handleException(e, stageName, errorDetailsProvider,
ErrorPhase.COMMITTING);
}
}

@Override
public void abortJob(JobContext jobContext, State state) {
try {
delegate.abortJob(jobContext, state);
} catch (Exception e) {
throw ErrorDetails.handleException(e, stageName, errorDetailsProvider,
ErrorPhase.COMMITTING);
}
}

@Override
public void setupTask(TaskAttemptContext taskAttemptContext) {
try {
Expand Down Expand Up @@ -100,10 +129,31 @@ public void abortTask(TaskAttemptContext taskAttemptContext) {
}

@Override
@Deprecated
public boolean isRecoverySupported() {
return delegate.isRecoverySupported();
}

@Override
public boolean isCommitJobRepeatable(JobContext jobContext) {
try {
return delegate.isCommitJobRepeatable(jobContext);
} catch (Exception e) {
throw ErrorDetails.handleException(e, stageName, errorDetailsProvider,
ErrorPhase.COMMITTING);
}
}

@Override
public boolean isRecoverySupported(JobContext jobContext) {
try {
return delegate.isRecoverySupported(jobContext);
} catch (Exception e) {
throw ErrorDetails.handleException(e, stageName, errorDetailsProvider,
ErrorPhase.COMMITTING);
}
}

@Override
public void recoverTask(TaskAttemptContext taskContext) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,21 @@ public void abortTask(TaskAttemptContext taskContext) throws IOException {
}

@Override
@Deprecated
public boolean isRecoverySupported() {
return delegate.isRecoverySupported();
}

@Override
public boolean isCommitJobRepeatable(JobContext jobContext) throws IOException {
return delegate.isCommitJobRepeatable(jobContext);
}

@Override
public boolean isRecoverySupported(JobContext jobContext) throws IOException {
return delegate.isRecoverySupported(jobContext);
}

@Override
public void recoverTask(TaskAttemptContext taskContext) throws IOException {
delegate.recoverTask(new TrackingTaskAttemptContext(taskContext));
Expand Down

0 comments on commit aeff034

Please sign in to comment.