本文整理汇总了Java中org.apache.flink.api.common.ExecutionConfig.setGlobalJobParameters方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutionConfig.setGlobalJobParameters方法的具体用法?Java ExecutionConfig.setGlobalJobParameters怎么用?Java ExecutionConfig.setGlobalJobParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.api.common.ExecutionConfig
的用法示例。
在下文中一共展示了ExecutionConfig.setGlobalJobParameters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addStormConfigToTopology
import org.apache.flink.api.common.ExecutionConfig; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
static void addStormConfigToTopology(FlinkTopology topology, Map conf) throws ClassNotFoundException {
if (conf != null) {
ExecutionConfig flinkConfig = topology.getExecutionEnvironment().getConfig();
flinkConfig.setGlobalJobParameters(new StormConfig(conf));
// add all registered types to ExecutionConfig
List<?> registeredClasses = (List<?>) conf.get(Config.TOPOLOGY_KRYO_REGISTER);
if (registeredClasses != null) {
for (Object klass : registeredClasses) {
if (klass instanceof String) {
flinkConfig.registerKryoType(Class.forName((String) klass));
} else {
for (Entry<String, String> register : ((Map<String, String>) klass).entrySet()) {
flinkConfig.registerTypeWithKryoSerializer(Class.forName(register.getKey()),
(Class<? extends Serializer<?>>) Class.forName(register.getValue()));
}
}
}
}
}
}
示例2: setupExecutionGraph
import org.apache.flink.api.common.ExecutionConfig; //导入方法依赖的package包/类
@BeforeClass
public static void setupExecutionGraph() throws Exception {
// -------------------------------------------------------------------------------------------------------------
// Setup
// -------------------------------------------------------------------------------------------------------------
JobVertexID v1ID = new JobVertexID();
JobVertexID v2ID = new JobVertexID();
JobVertex v1 = new JobVertex("v1", v1ID);
JobVertex v2 = new JobVertex("v2", v2ID);
v1.setParallelism(1);
v2.setParallelism(2);
v1.setInvokableClass(AbstractInvokable.class);
v2.setInvokableClass(AbstractInvokable.class);
List<JobVertex> vertices = new ArrayList<>(Arrays.asList(v1, v2));
ExecutionConfig config = new ExecutionConfig();
config.setExecutionMode(ExecutionMode.BATCH_FORCED);
config.setRestartStrategy(new RestartStrategies.NoRestartStrategyConfiguration());
config.setParallelism(4);
config.enableObjectReuse();
config.setGlobalJobParameters(new TestJobParameters());
runtimeGraph = new ExecutionGraph(
TestingUtils.defaultExecutor(),
TestingUtils.defaultExecutor(),
new JobID(),
"test job",
new Configuration(),
new SerializedValue<>(config),
AkkaUtils.getDefaultTimeout(),
new NoRestartStrategy(),
mock(SlotProvider.class));
runtimeGraph.attachJobGraph(vertices);
List<ExecutionJobVertex> jobVertices = new ArrayList<>();
jobVertices.add(runtimeGraph.getJobVertex(v1ID));
jobVertices.add(runtimeGraph.getJobVertex(v2ID));
CheckpointStatsTracker statsTracker = new CheckpointStatsTracker(
0,
jobVertices,
mock(CheckpointCoordinatorConfiguration.class),
new UnregisteredMetricsGroup());
runtimeGraph.enableCheckpointing(
100,
100,
100,
1,
CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION,
Collections.<ExecutionJobVertex>emptyList(),
Collections.<ExecutionJobVertex>emptyList(),
Collections.<ExecutionJobVertex>emptyList(),
Collections.<MasterTriggerRestoreHook<?>>emptyList(),
new StandaloneCheckpointIDCounter(),
new StandaloneCompletedCheckpointStore(1),
new MemoryStateBackend(),
statsTracker);
runtimeGraph.setJsonPlan("{}");
runtimeGraph.getJobVertex(v2ID).getTaskVertices()[0].getCurrentExecutionAttempt().fail(new RuntimeException("This exception was thrown on purpose."));
}