Java Code Examples for org.apache.flink.util.InstantiationUtil#writeObjectToConfig()

The following examples show how to use org.apache.flink.util.InstantiationUtil#writeObjectToConfig() . 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: TaskConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public void setOutputPartitioner(Partitioner<?> partitioner, int outputNum) {
	try {
		InstantiationUtil.writeObjectToConfig(partitioner, config, OUTPUT_PARTITIONER + outputNum);
	}
	catch (Throwable t) {
		throw new RuntimeException("Could not serialize custom partitioner.", t);
	}
}
 
Example 2
Source File: StreamConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public void setStateKeySerializer(TypeSerializer<?> serializer) {
	try {
		InstantiationUtil.writeObjectToConfig(serializer, this.config, STATE_KEY_SERIALIZER);
	} catch (IOException e) {
		throw new StreamTaskException("Could not serialize state key serializer.", e);
	}
}
 
Example 3
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public void setOutEdgesInOrder(List<StreamEdge> outEdgeList) {
	try {
		InstantiationUtil.writeObjectToConfig(outEdgeList, this.config, EDGES_IN_ORDER);
	} catch (IOException e) {
		throw new StreamTaskException("Could not serialize outputs in order.", e);
	}
}
 
Example 4
Source File: TaskConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public void setOutputPartitioner(Partitioner<?> partitioner, int outputNum) {
	try {
		InstantiationUtil.writeObjectToConfig(partitioner, config, OUTPUT_PARTITIONER + outputNum);
	}
	catch (Throwable t) {
		throw new RuntimeException("Could not serialize custom partitioner.", t);
	}
}
 
Example 5
Source File: StreamConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public void setTransitiveChainedTaskConfigs(Map<Integer, StreamConfig> chainedTaskConfigs) {

		try {
			InstantiationUtil.writeObjectToConfig(chainedTaskConfigs, this.config, CHAINED_TASK_CONFIG);
		} catch (IOException e) {
			throw new StreamTaskException("Could not serialize configuration.", e);
		}
	}
 
Example 6
Source File: StreamConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public void setOutEdgesInOrder(List<StreamEdge> outEdgeList) {
	try {
		InstantiationUtil.writeObjectToConfig(outEdgeList, this.config, EDGES_IN_ORDER);
	} catch (IOException e) {
		throw new StreamTaskException("Could not serialize outputs in order.", e);
	}
}
 
Example 7
Source File: StreamConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public void setInPhysicalEdges(List<StreamEdge> inEdges) {
	try {
		InstantiationUtil.writeObjectToConfig(inEdges, this.config, IN_STREAM_EDGES);
	} catch (IOException e) {
		throw new StreamTaskException("Cannot serialize inward edges.", e);
	}
}
 
Example 8
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
private void setTypeSerializer(String key, TypeSerializer<?> typeWrapper) {
	try {
		InstantiationUtil.writeObjectToConfig(typeWrapper, this.config, key);
	} catch (IOException e) {
		throw new StreamTaskException("Could not serialize type serializer.", e);
	}
}
 
Example 9
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public void setInPhysicalEdges(List<StreamEdge> inEdges) {
	try {
		InstantiationUtil.writeObjectToConfig(inEdges, this.config, IN_STREAM_EDGES);
	} catch (IOException e) {
		throw new StreamTaskException("Cannot serialize inward edges.", e);
	}
}
 
Example 10
Source File: TaskConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public void addIterationAggregator(String name, Aggregator<?> aggregator) {
	int num = this.config.getInteger(ITERATION_NUM_AGGREGATORS, 0);
	this.config.setString(ITERATION_AGGREGATOR_NAME_PREFIX + num, name);
	try {
			InstantiationUtil.writeObjectToConfig(aggregator, this.config, ITERATION_AGGREGATOR_PREFIX + num);
	} catch (IOException e) {
			throw new RuntimeException("Error while writing the aggregator object to the task configuration.");
	}
	this.config.setInteger(ITERATION_NUM_AGGREGATORS, num + 1);
}
 
Example 11
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public void setChainedOutputs(List<StreamEdge> chainedOutputs) {
	try {
		InstantiationUtil.writeObjectToConfig(chainedOutputs, this.config, CHAINED_OUTPUTS);
	} catch (IOException e) {
		throw new StreamTaskException("Cannot serialize chained outputs.", e);
	}
}
 
Example 12
Source File: StreamConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public void setStreamOperator(StreamOperator<?> operator) {
	if (operator != null) {
		config.setClass(USER_FUNCTION, operator.getClass());

		try {
			InstantiationUtil.writeObjectToConfig(operator, this.config, SERIALIZEDUDF);
		} catch (IOException e) {
			throw new StreamTaskException("Cannot serialize operator object "
					+ operator.getClass() + ".", e);
		}
	}
}
 
Example 13
Source File: StreamConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private void setTypeSerializer(String key, TypeSerializer<?> typeWrapper) {
	try {
		InstantiationUtil.writeObjectToConfig(typeWrapper, this.config, key);
	} catch (IOException e) {
		throw new StreamTaskException("Could not serialize type serializer.", e);
	}
}
 
Example 14
Source File: TaskConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the default convergence criterion of a {@link DeltaIteration}
 *
 * @param aggregatorName
 * @param convCriterion
 */
public void setImplicitConvergenceCriterion(String aggregatorName, ConvergenceCriterion<?> convCriterion) {
	try {
		InstantiationUtil.writeObjectToConfig(convCriterion, this.config, ITERATION_IMPLICIT_CONVERGENCE_CRITERION);
	} catch (IOException e) {
		throw new RuntimeException("Error while writing the implicit convergence criterion object to the task configuration.");
	}
	this.config.setString(ITERATION_IMPLICIT_CONVERGENCE_CRITERION_AGG_NAME, aggregatorName);
}
 
Example 15
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public void setStatePartitioner(int input, KeySelector<?, ?> partitioner) {
	try {
		InstantiationUtil.writeObjectToConfig(partitioner, this.config, STATE_PARTITIONER + input);
	} catch (IOException e) {
		throw new StreamTaskException("Could not serialize state partitioner.", e);
	}
}
 
Example 16
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public void setStatePartitioner(int input, KeySelector<?, ?> partitioner) {
	try {
		InstantiationUtil.writeObjectToConfig(partitioner, this.config, STATE_PARTITIONER + input);
	} catch (IOException e) {
		throw new StreamTaskException("Could not serialize state partitioner.", e);
	}
}
 
Example 17
Source File: TaskConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public void addIterationAggregators(Collection<AggregatorWithName<?>> aggregators) {
	int num = this.config.getInteger(ITERATION_NUM_AGGREGATORS, 0);
	for (AggregatorWithName<?> awn : aggregators) {
		this.config.setString(ITERATION_AGGREGATOR_NAME_PREFIX + num, awn.getName());
		try {
			InstantiationUtil.writeObjectToConfig(awn.getAggregator(), this.config, ITERATION_AGGREGATOR_PREFIX + num);
		} catch (IOException e) {
			throw new RuntimeException("Error while writing the aggregator object to the task configuration.");
		}
		num++;
	}
	this.config.setInteger(ITERATION_NUM_AGGREGATORS, num);
}
 
Example 18
Source File: TaskConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public void addIterationAggregators(Collection<AggregatorWithName<?>> aggregators) {
	int num = this.config.getInteger(ITERATION_NUM_AGGREGATORS, 0);
	for (AggregatorWithName<?> awn : aggregators) {
		this.config.setString(ITERATION_AGGREGATOR_NAME_PREFIX + num, awn.getName());
		try {
			InstantiationUtil.writeObjectToConfig(awn.getAggregator(), this.config, ITERATION_AGGREGATOR_PREFIX + num);
		} catch (IOException e) {
			throw new RuntimeException("Error while writing the aggregator object to the task configuration.");
		}
		num++;
	}
	this.config.setInteger(ITERATION_NUM_AGGREGATORS, num);
}
 
Example 19
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public void setOutEdges(List<StreamEdge> outEdges) {
	try {
		InstantiationUtil.writeObjectToConfig(outEdges, this.config, OUT_STREAM_EDGES);
	} catch (IOException e) {
		throw new StreamTaskException("Cannot serialize outward edges.", e);
	}
}
 
Example 20
Source File: RuntimeComparatorFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void writeParametersToConfig(Configuration config) {
	try {
		InstantiationUtil.writeObjectToConfig(comparator, config, CONFIG_KEY);
	}
	catch (Exception e) {
		throw new RuntimeException("Could not serialize comparator into the configuration.", e);
	}
}