Java Code Examples for org.apache.flink.runtime.execution.Environment#getDistributedCacheEntries()

The following examples show how to use org.apache.flink.runtime.execution.Environment#getDistributedCacheEntries() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamingRuntimeContext.java    From flink with Apache License 2.0 6 votes vote down vote up
public StreamingRuntimeContext(
		Environment env,
		Map<String, Accumulator<?, ?>> accumulators,
		MetricGroup operatorMetricGroup,
		OperatorID operatorID,
		ProcessingTimeService processingTimeService,
		@Nullable KeyedStateStore keyedStateStore,
		ExternalResourceInfoProvider externalResourceInfoProvider) {
	super(checkNotNull(env).getTaskInfo(),
			env.getUserClassLoader(),
			env.getExecutionConfig(),
			accumulators,
			env.getDistributedCacheEntries(),
			operatorMetricGroup);
	this.taskEnvironment = env;
	this.streamConfig = new StreamConfig(env.getTaskConfiguration());
	this.operatorUniqueID = checkNotNull(operatorID).toString();
	this.processingTimeService = processingTimeService;
	this.keyedStateStore = keyedStateStore;
	this.externalResourceInfoProvider = externalResourceInfoProvider;
}
 
Example 2
Source File: ChainedDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
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().getOrAddOperator(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);
}
 
Example 3
Source File: DataSourceTask.java    From flink with Apache License 2.0 5 votes vote down vote up
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().getOrAddOperator(sourceName), env.getExternalResourceInfoProvider());
}
 
Example 4
Source File: ChainedDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
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().getOrAddOperator(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, env.getExternalResourceInfoProvider()
		);
	}

	this.executionConfig = executionConfig;
	this.objectReuseEnabled = executionConfig.isObjectReuseEnabled();

	setup(parent);
}
 
Example 5
Source File: DataSinkTask.java    From flink with Apache License 2.0 5 votes vote down vote up
public DistributedRuntimeUDFContext createRuntimeContext() {
	Environment env = getEnvironment();

	return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
			getExecutionConfig(), env.getDistributedCacheEntries(), env.getAccumulatorRegistry().getUserMap(), 
			getEnvironment().getMetricGroup().getOrAddOperator(getEnvironment().getTaskInfo().getTaskName()), env.getExternalResourceInfoProvider());
}
 
Example 6
Source File: AbstractIterativeTask.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public DistributedRuntimeUDFContext createRuntimeContext(MetricGroup metrics) {
	Environment env = getEnvironment();

	return new IterativeRuntimeUdfContext(env.getTaskInfo(), getUserCodeClassLoader(),
			getExecutionConfig(), env.getDistributedCacheEntries(), this.accumulatorMap, metrics, env.getExternalResourceInfoProvider());
}
 
Example 7
Source File: StreamingRuntimeContext.java    From flink with Apache License 2.0 5 votes vote down vote up
public StreamingRuntimeContext(AbstractStreamOperator<?> operator,
								Environment env, Map<String, Accumulator<?, ?>> accumulators) {
	super(env.getTaskInfo(),
			env.getUserClassLoader(),
			operator.getExecutionConfig(),
			accumulators,
			env.getDistributedCacheEntries(),
			operator.getMetricGroup());

	this.operator = operator;
	this.taskEnvironment = env;
	this.streamConfig = new StreamConfig(env.getTaskConfiguration());
	this.operatorUniqueID = operator.getOperatorID().toString();
}
 
Example 8
Source File: DataSourceTask.java    From flink with Apache License 2.0 5 votes vote down vote up
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().getOrAddOperator(sourceName));
}
 
Example 9
Source File: DataSinkTask.java    From flink with Apache License 2.0 5 votes vote down vote up
public DistributedRuntimeUDFContext createRuntimeContext() {
	Environment env = getEnvironment();

	return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
			getExecutionConfig(), env.getDistributedCacheEntries(), env.getAccumulatorRegistry().getUserMap(), 
			getEnvironment().getMetricGroup().getOrAddOperator(getEnvironment().getTaskInfo().getTaskName()));
}
 
Example 10
Source File: StreamingRuntimeContext.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public StreamingRuntimeContext(AbstractStreamOperator<?> operator,
								Environment env, Map<String, Accumulator<?, ?>> accumulators) {
	super(env.getTaskInfo(),
			env.getUserClassLoader(),
			operator.getExecutionConfig(),
			accumulators,
			env.getDistributedCacheEntries(),
			operator.getMetricGroup());

	this.operator = operator;
	this.taskEnvironment = env;
	this.streamConfig = new StreamConfig(env.getTaskConfiguration());
	this.operatorUniqueID = operator.getOperatorID().toString();
}
 
Example 11
Source File: DataSourceTask.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
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().getOrAddOperator(sourceName));
}
 
Example 12
Source File: ChainedDriver.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
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().getOrAddOperator(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);
}
 
Example 13
Source File: DataSinkTask.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public DistributedRuntimeUDFContext createRuntimeContext() {
	Environment env = getEnvironment();

	return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
			getExecutionConfig(), env.getDistributedCacheEntries(), env.getAccumulatorRegistry().getUserMap(), 
			getEnvironment().getMetricGroup().getOrAddOperator(getEnvironment().getTaskInfo().getTaskName()));
}
 
Example 14
Source File: AbstractIterativeTask.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public DistributedRuntimeUDFContext createRuntimeContext(MetricGroup metrics) {
	Environment env = getEnvironment();
	return new IterativeRuntimeUdfContext(env.getTaskInfo(), getUserCodeClassLoader(),
			getExecutionConfig(), env.getDistributedCacheEntries(), this.accumulatorMap, metrics);
}
 
Example 15
Source File: BatchTask.java    From flink with Apache License 2.0 4 votes vote down vote up
public DistributedRuntimeUDFContext createRuntimeContext(MetricGroup metrics) {
	Environment env = getEnvironment();

	return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
			getExecutionConfig(), env.getDistributedCacheEntries(), this.accumulatorMap, metrics);
}
 
Example 16
Source File: AbstractIterativeTask.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public DistributedRuntimeUDFContext createRuntimeContext(MetricGroup metrics) {
	Environment env = getEnvironment();
	return new IterativeRuntimeUdfContext(env.getTaskInfo(), getUserCodeClassLoader(),
			getExecutionConfig(), env.getDistributedCacheEntries(), this.accumulatorMap, metrics);
}
 
Example 17
Source File: BatchTask.java    From flink with Apache License 2.0 4 votes vote down vote up
public DistributedRuntimeUDFContext createRuntimeContext(MetricGroup metrics) {
	Environment env = getEnvironment();

	return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
			getExecutionConfig(), env.getDistributedCacheEntries(), this.accumulatorMap, metrics, env.getExternalResourceInfoProvider());
}
 
Example 18
Source File: BatchTask.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public DistributedRuntimeUDFContext createRuntimeContext(MetricGroup metrics) {
	Environment env = getEnvironment();

	return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
			getExecutionConfig(), env.getDistributedCacheEntries(), this.accumulatorMap, metrics);
}