Search in sources :

Example 1 with FinalizeOnMaster

use of org.apache.flink.api.common.io.FinalizeOnMaster in project flink by apache.

the class OutputFormatVertex method finalizeOnMaster.

@Override
public void finalizeOnMaster(ClassLoader loader) throws Exception {
    final TaskConfig cfg = new TaskConfig(getConfiguration());
    UserCodeWrapper<OutputFormat<?>> wrapper;
    try {
        wrapper = cfg.<OutputFormat<?>>getStubWrapper(loader);
    } catch (Throwable t) {
        throw new Exception("Deserializing the OutputFormat (" + formatDescription + ") failed: " + t.getMessage(), t);
    }
    if (wrapper == null) {
        throw new Exception("No input format present in InputFormatVertex's task configuration.");
    }
    OutputFormat<?> outputFormat;
    try {
        outputFormat = wrapper.getUserCodeObject(OutputFormat.class, loader);
    } catch (Throwable t) {
        throw new Exception("Instantiating the OutputFormat (" + formatDescription + ") failed: " + t.getMessage(), t);
    }
    try {
        outputFormat.configure(cfg.getStubParameters());
    } catch (Throwable t) {
        throw new Exception("Configuring the OutputFormat (" + formatDescription + ") failed: " + t.getMessage(), t);
    }
    if (outputFormat instanceof FinalizeOnMaster) {
        ((FinalizeOnMaster) outputFormat).finalizeGlobal(getParallelism());
    }
}
Also used : FinalizeOnMaster(org.apache.flink.api.common.io.FinalizeOnMaster) OutputFormat(org.apache.flink.api.common.io.OutputFormat) TaskConfig(org.apache.flink.runtime.operators.util.TaskConfig)

Aggregations

FinalizeOnMaster (org.apache.flink.api.common.io.FinalizeOnMaster)1 OutputFormat (org.apache.flink.api.common.io.OutputFormat)1 TaskConfig (org.apache.flink.runtime.operators.util.TaskConfig)1