use of org.apache.flink.state.api.output.TaggedOperatorSubtaskState in project flink by apache.
the class StateBootstrapTransformation method writeOperatorSubtaskStates.
private SingleOutputStreamOperator<TaggedOperatorSubtaskState> writeOperatorSubtaskStates(OperatorID operatorID, StateBackend stateBackend, Configuration additionalConfig, Path savepointPath, int localMaxParallelism) {
StreamOperator<TaggedOperatorSubtaskState> operator = factory.createOperator(System.currentTimeMillis(), savepointPath);
operator = stream.getExecutionEnvironment().clean(operator);
final StreamConfig config = getConfig(operatorID, stateBackend, additionalConfig, operator);
BootstrapStreamTaskRunner<T> operatorRunner = new BootstrapStreamTaskRunner<>(config, localMaxParallelism);
DataStream<T> input = stream;
if (keySelector != null) {
input = stream.keyBy(this.keySelector);
}
SingleOutputStreamOperator<TaggedOperatorSubtaskState> subtaskStates = input.transform(operatorID.toHexString(), TypeInformation.of(TaggedOperatorSubtaskState.class), operatorRunner).setMaxParallelism(localMaxParallelism);
if (operator instanceof BroadcastStateBootstrapOperator) {
subtaskStates = subtaskStates.setParallelism(1);
} else {
int currentParallelism = getParallelism(subtaskStates);
if (currentParallelism > localMaxParallelism) {
subtaskStates.setParallelism(localMaxParallelism);
}
}
return subtaskStates;
}
use of org.apache.flink.state.api.output.TaggedOperatorSubtaskState in project flink by apache.
the class BroadcastStateBootstrapOperator method endInput.
@Override
public void endInput() throws Exception {
TaggedOperatorSubtaskState state = SnapshotUtils.snapshot(this, getRuntimeContext().getIndexOfThisSubtask(), timestamp, getContainingTask().getConfiguration().isExactlyOnceCheckpointMode(), getContainingTask().getConfiguration().isUnalignedCheckpointsEnabled(), getContainingTask().getConfiguration().getConfiguration(), savepointPath);
output.collect(new StreamRecord<>(state));
}
use of org.apache.flink.state.api.output.TaggedOperatorSubtaskState in project flink by apache.
the class StateBootstrapOperator method endInput.
@Override
public void endInput() throws Exception {
TaggedOperatorSubtaskState state = SnapshotUtils.snapshot(this, getRuntimeContext().getIndexOfThisSubtask(), timestamp, getContainingTask().getConfiguration().isExactlyOnceCheckpointMode(), getContainingTask().getConfiguration().isUnalignedCheckpointsEnabled(), getContainingTask().getConfiguration().getConfiguration(), savepointPath);
output.collect(new StreamRecord<>(state));
}
use of org.apache.flink.state.api.output.TaggedOperatorSubtaskState in project flink by apache.
the class StateBootstrapWrapperOperator method endInput.
@Override
public void endInput() throws Exception {
TaggedOperatorSubtaskState state = SnapshotUtils.snapshot(this, operator.getContainingTask().getEnvironment().getTaskInfo().getIndexOfThisSubtask(), timestamp, operator.getContainingTask().getConfiguration().isExactlyOnceCheckpointMode(), operator.getContainingTask().getConfiguration().isUnalignedCheckpointsEnabled(), operator.getContainingTask().getConfiguration().getConfiguration(), savepointPath);
output.collect(new StreamRecord<>(state));
}
Aggregations