Search in sources :

Example 1 with CommitSequencePublisher

use of org.apache.gobblin.publisher.CommitSequencePublisher in project incubator-gobblin by apache.

the class SafeDatasetCommit method generateCommitSequenceBuilder.

@SuppressWarnings("unchecked")
private Optional<CommitSequence.Builder> generateCommitSequenceBuilder(JobState.DatasetState datasetState, Collection<TaskState> taskStates) {
    try (Closer closer = Closer.create()) {
        Class<? extends CommitSequencePublisher> dataPublisherClass = (Class<? extends CommitSequencePublisher>) Class.forName(datasetState.getProp(ConfigurationKeys.DATA_PUBLISHER_TYPE, ConfigurationKeys.DEFAULT_DATA_PUBLISHER_TYPE));
        CommitSequencePublisher publisher = (CommitSequencePublisher) closer.register(DataPublisher.getInstance(dataPublisherClass, this.jobContext.getJobState()));
        publisher.publish(taskStates);
        return publisher.getCommitSequenceBuilder();
    } catch (Throwable t) {
        log.error("Failed to generate commit sequence", t);
        setTaskFailureException(datasetState.getTaskStates(), t);
        throw Throwables.propagate(t);
    }
}
Also used : Closer(com.google.common.io.Closer) CommitSequencePublisher(org.apache.gobblin.publisher.CommitSequencePublisher)

Aggregations

Closer (com.google.common.io.Closer)1 CommitSequencePublisher (org.apache.gobblin.publisher.CommitSequencePublisher)1