use of org.apache.flink.runtime.operators.util.DistributedRuntimeUDFContext in project flink by apache.
the class DataSourceTask method createRuntimeContext.
public DistributedRuntimeUDFContext createRuntimeContext() {
Environment env = getEnvironment();
String sourceName = getEnvironment().getTaskInfo().getTaskName().split("->")[0].trim();
sourceName = sourceName.startsWith("CHAIN") ? sourceName.substring(6) : sourceName;
return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(), getExecutionConfig(), env.getDistributedCacheEntries(), env.getAccumulatorRegistry().getUserMap(), getEnvironment().getMetricGroup().addOperator(sourceName));
}
use of org.apache.flink.runtime.operators.util.DistributedRuntimeUDFContext in project flink by apache.
the class ChainedDriver method setup.
public void setup(TaskConfig config, String taskName, Collector<OT> outputCollector, AbstractInvokable parent, ClassLoader userCodeClassLoader, ExecutionConfig executionConfig, Map<String, Accumulator<?, ?>> accumulatorMap) {
this.config = config;
this.taskName = taskName;
this.userCodeClassLoader = userCodeClassLoader;
this.metrics = parent.getEnvironment().getMetricGroup().addOperator(taskName);
this.numRecordsIn = this.metrics.getIOMetricGroup().getNumRecordsInCounter();
this.numRecordsOut = this.metrics.getIOMetricGroup().getNumRecordsOutCounter();
this.outputCollector = new CountingCollector<>(outputCollector, numRecordsOut);
Environment env = parent.getEnvironment();
if (parent instanceof BatchTask) {
this.udfContext = ((BatchTask<?, ?>) parent).createRuntimeContext(metrics);
} else {
this.udfContext = new DistributedRuntimeUDFContext(env.getTaskInfo(), userCodeClassLoader, parent.getExecutionConfig(), env.getDistributedCacheEntries(), accumulatorMap, metrics);
}
this.executionConfig = executionConfig;
this.objectReuseEnabled = executionConfig.isObjectReuseEnabled();
setup(parent);
}
Aggregations