@Override public void onFailure() throws DataSetException { if (dataset instanceof DatasetOutputCommitter) { ((DatasetOutputCommitter) dataset).onFailure(); } } }
@Override public void onFailure() throws DataSetException { if (dataset instanceof DatasetOutputCommitter) { ((DatasetOutputCommitter) dataset).onFailure(); } } }
/** * Calls onFailure for all of the DatasetOutputCommitters. If any operation throws an exception, it is suppressed * until onFailure is called on all of the DatasetOutputCommitters. */ private void failOutputs(Map<String, DatasetOutputCommitter> datasetOutputCommiters) throws Exception { if (completedCallingOnFailure) { // guard against multiple calls to OutputCommitter#abortJob LOG.info("Not calling onFailure on outputs, as it has they have already been executed."); return; } Exception e = null; for (Map.Entry<String, DatasetOutputCommitter> datasetOutputCommitter : datasetOutputCommiters.entrySet()) { try { datasetOutputCommitter.getValue().onFailure(); } catch (Exception suppressedException) { LOG.error(String.format("Error from onFailure method of output dataset %s.", datasetOutputCommitter.getKey()), suppressedException); if (e != null) { e.addSuppressed(suppressedException); } else { e = suppressedException; } } } completedCallingOnFailure = true; if (e != null) { throw e; } }
/** * Calls onFailure for all of the DatasetOutputCommitters. If any operation throws an exception, it is suppressed * until onFailure is called on all of the DatasetOutputCommitters. */ private void failOutputs(Map<String, DatasetOutputCommitter> datasetOutputCommiters) throws Exception { if (completedCallingOnFailure) { // guard against multiple calls to OutputCommitter#abortJob LOG.info("Not calling onFailure on outputs, as it has they have already been executed."); return; } Exception e = null; for (Map.Entry<String, DatasetOutputCommitter> datasetOutputCommitter : datasetOutputCommiters.entrySet()) { try { datasetOutputCommitter.getValue().onFailure(); } catch (Exception suppressedException) { LOG.error(String.format("Error from onFailure method of output dataset %s.", datasetOutputCommitter.getKey()), suppressedException); if (e != null) { e.addSuppressed(suppressedException); } else { e = suppressedException; } } } completedCallingOnFailure = true; if (e != null) { throw e; } }