当前位置: 首页>>代码示例>>Java>>正文


Java JobGraph.getVertices方法代码示例

本文整理汇总了Java中org.apache.flink.runtime.jobgraph.JobGraph.getVertices方法的典型用法代码示例。如果您正苦于以下问题:Java JobGraph.getVertices方法的具体用法?Java JobGraph.getVertices怎么用?Java JobGraph.getVertices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.flink.runtime.jobgraph.JobGraph的用法示例。


在下文中一共展示了JobGraph.getVertices方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNodeHashIdenticalNodes

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
/**
 * Tests that there are no collisions with two identical intermediate nodes connected to the
 * same predecessor.
 *
 * <pre>
 *             /-> [ (map) ] -> [ (sink) ]
 * [ (src) ] -+
 *             \-> [ (map) ] -> [ (sink) ]
 * </pre>
 */
@Test
public void testNodeHashIdenticalNodes() throws Exception {
	StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironment();
	env.setParallelism(4);
	env.disableOperatorChaining();

	DataStream<String> src = env.addSource(new NoOpSourceFunction());

	src.map(new NoOpMapFunction()).addSink(new NoOpSinkFunction());

	src.map(new NoOpMapFunction()).addSink(new NoOpSinkFunction());

	JobGraph jobGraph = env.getStreamGraph().getJobGraph();
	Set<JobVertexID> vertexIds = new HashSet<>();
	for (JobVertex vertex : jobGraph.getVertices()) {
		assertTrue(vertexIds.add(vertex.getID()));
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:29,代码来源:StreamingJobGraphGeneratorNodeHashTest.java

示例2: checkVertexExists

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
private void checkVertexExists(String vertexId, JobGraph graph) {
	// validate that the vertex has a valid 
	JobVertexID id = JobVertexID.fromHexString(vertexId);
	for (JobVertex vertex : graph.getVertices()) {
		if (vertex.getID().equals(id)) {
			return;
		}
	}
	fail("could not find vertex with id " + vertexId + " in JobGraph");
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:JsonGeneratorTest.java

示例3: rememberIds

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
/**
 * Returns a {@link JobVertexID} to vertex name mapping for the given graph.
 */
private Map<JobVertexID, String> rememberIds(JobGraph jobGraph) {
	final Map<JobVertexID, String> ids = new HashMap<>();
	for (JobVertex vertex : jobGraph.getVertices()) {
		ids.put(vertex.getID(), vertex.getName());
	}
	return ids;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:StreamingJobGraphGeneratorNodeHashTest.java

示例4: verifyIdsEqual

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
/**
 * Verifies that each {@link JobVertexID} of the {@link JobGraph} is contained in the given map
 * and mapped to the same vertex name.
 */
private void verifyIdsEqual(JobGraph jobGraph, Map<JobVertexID, String> ids) {
	// Verify same number of vertices
	assertEquals(jobGraph.getNumberOfVertices(), ids.size());

	// Verify that all IDs->name mappings are identical
	for (JobVertex vertex : jobGraph.getVertices()) {
		String expectedName = ids.get(vertex.getID());
		assertNotNull(expectedName);
		assertEquals(expectedName, vertex.getName());
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:16,代码来源:StreamingJobGraphGeneratorNodeHashTest.java

示例5: verifyIdsNotEqual

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
/**
 * Verifies that no {@link JobVertexID} of the {@link JobGraph} is contained in the given map.
 */
private void verifyIdsNotEqual(JobGraph jobGraph, Map<JobVertexID, String> ids) {
	// Verify same number of vertices
	assertEquals(jobGraph.getNumberOfVertices(), ids.size());

	// Verify that all IDs->name mappings are identical
	for (JobVertex vertex : jobGraph.getVertices()) {
		assertFalse(ids.containsKey(vertex.getID()));
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:StreamingJobGraphGeneratorNodeHashTest.java

示例6: testTempInIterationTest

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
@Test
public void testTempInIterationTest() throws Exception {

	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	DataSet<Tuple2<Long, Long>> input = env.readCsvFile("file:///does/not/exist").types(Long.class, Long.class);

	DeltaIteration<Tuple2<Long, Long>, Tuple2<Long, Long>> iteration =
			input.iterateDelta(input, 1, 0);

	DataSet<Tuple2<Long, Long>> update = iteration.getWorkset()
			.join(iteration.getSolutionSet()).where(0).equalTo(0)
				.with(new DummyFlatJoinFunction<Tuple2<Long, Long>>());

	iteration.closeWith(update, update)
			.output(new DiscardingOutputFormat<Tuple2<Long, Long>>());


	Plan plan = env.createProgramPlan();
	OptimizedPlan oPlan = (new Optimizer(new Configuration())).compile(plan);

	JobGraphGenerator jgg = new JobGraphGenerator();
	JobGraph jg = jgg.compileJobGraph(oPlan);

	boolean solutionSetUpdateChecked = false;
	for(JobVertex v : jg.getVertices()) {
		if(v.getName().equals("SolutionSet Delta")) {

			// check if input of solution set delta is temped
			TaskConfig tc = new TaskConfig(v.getConfiguration());
			assertTrue(tc.isInputAsynchronouslyMaterialized(0));
			solutionSetUpdateChecked = true;
		}
	}
	assertTrue(solutionSetUpdateChecked);

}
 
开发者ID:axbaretto,项目名称:flink,代码行数:38,代码来源:TempInIterationsTest.java


注:本文中的org.apache.flink.runtime.jobgraph.JobGraph.getVertices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。