Search in sources :

Example 1 with ConstructState

use of org.apache.gobblin.state.ConstructState in project incubator-gobblin by apache.

the class Task method addConstructsFinalStateToTaskState.

/**
 * Get the final state of each construct used by this task and add it to the {@link org.apache.gobblin.runtime.TaskState}.
 * @param extractor the {@link org.apache.gobblin.instrumented.extractor.InstrumentedExtractorBase} used by this task.
 * @param converter the {@link org.apache.gobblin.converter.Converter} used by this task.
 * @param rowChecker the {@link RowLevelPolicyChecker} used by this task.
 */
private void addConstructsFinalStateToTaskState(InstrumentedExtractorBase<?, ?> extractor, Converter<?, ?, ?, ?> converter, RowLevelPolicyChecker rowChecker) {
    ConstructState constructState = new ConstructState();
    if (extractor != null) {
        constructState.addConstructState(Constructs.EXTRACTOR, new ConstructState(extractor.getFinalState()));
    }
    if (converter != null) {
        constructState.addConstructState(Constructs.CONVERTER, new ConstructState(converter.getFinalState()));
    }
    if (rowChecker != null) {
        constructState.addConstructState(Constructs.ROW_QUALITY_CHECKER, new ConstructState(rowChecker.getFinalState()));
    }
    int forkIdx = 0;
    for (Optional<Fork> fork : this.forks.keySet()) {
        constructState.addConstructState(Constructs.FORK_OPERATOR, new ConstructState(fork.get().getFinalState()), Integer.toString(forkIdx));
        forkIdx++;
    }
    constructState.mergeIntoWorkUnitState(this.taskState);
}
Also used : ConstructState(org.apache.gobblin.state.ConstructState) AsynchronousFork(org.apache.gobblin.runtime.fork.AsynchronousFork) Fork(org.apache.gobblin.runtime.fork.Fork) SynchronousFork(org.apache.gobblin.runtime.fork.SynchronousFork)

Example 2 with ConstructState

use of org.apache.gobblin.state.ConstructState in project incubator-gobblin by apache.

the class FileAwareInputStreamDataWriter method getFinalState.

@Override
public State getFinalState() {
    State state = new State();
    if (this.actualProcessedCopyableFile.isPresent()) {
        CopySource.serializeCopyEntity(state, this.actualProcessedCopyableFile.get());
    }
    ConstructState constructState = new ConstructState();
    constructState.addOverwriteProperties(state);
    return constructState;
}
Also used : ConstructState(org.apache.gobblin.state.ConstructState) State(org.apache.gobblin.configuration.State) FinalState(org.apache.gobblin.util.FinalState) WorkUnitState(org.apache.gobblin.configuration.WorkUnitState) ConstructState(org.apache.gobblin.state.ConstructState)

Aggregations

ConstructState (org.apache.gobblin.state.ConstructState)2 State (org.apache.gobblin.configuration.State)1 WorkUnitState (org.apache.gobblin.configuration.WorkUnitState)1 AsynchronousFork (org.apache.gobblin.runtime.fork.AsynchronousFork)1 Fork (org.apache.gobblin.runtime.fork.Fork)1 SynchronousFork (org.apache.gobblin.runtime.fork.SynchronousFork)1 FinalState (org.apache.gobblin.util.FinalState)1