Search in sources :

Example 1 with DistributedRuntimeUDFContext

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));
}
Also used : DistributedRuntimeUDFContext(org.apache.flink.runtime.operators.util.DistributedRuntimeUDFContext) Environment(org.apache.flink.runtime.execution.Environment)

Example 2 with DistributedRuntimeUDFContext

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);
}
Also used : DistributedRuntimeUDFContext(org.apache.flink.runtime.operators.util.DistributedRuntimeUDFContext) BatchTask(org.apache.flink.runtime.operators.BatchTask) Environment(org.apache.flink.runtime.execution.Environment)

Aggregations

Environment (org.apache.flink.runtime.execution.Environment)2 DistributedRuntimeUDFContext (org.apache.flink.runtime.operators.util.DistributedRuntimeUDFContext)2 BatchTask (org.apache.flink.runtime.operators.BatchTask)1