Java Code Examples for org.apache.flink.runtime.jobgraph.JobGraph#addVertex()

The following examples show how to use org.apache.flink.runtime.jobgraph.JobGraph#addVertex() . 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: DefaultSchedulerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private static JobGraph nonParallelSourceSinkJobGraph() {
	final JobGraph jobGraph = new JobGraph(TEST_JOB_ID, "Testjob");
	jobGraph.setScheduleMode(ScheduleMode.EAGER);

	final JobVertex source = new JobVertex("source");
	source.setInvokableClass(NoOpInvokable.class);
	jobGraph.addVertex(source);

	final JobVertex sink = new JobVertex("sink");
	sink.setInvokableClass(NoOpInvokable.class);
	jobGraph.addVertex(sink);

	sink.connectNewDataSetAsInput(source, DistributionPattern.POINTWISE, ResultPartitionType.PIPELINED);

	return jobGraph;
}
 
Example 2
Source File: BackPressureStatsTrackerImplITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static JobGraph createJobWithBackPressure() {
	final JobGraph jobGraph = new JobGraph(TEST_JOB_ID, "Test Job");

	TEST_JOB_VERTEX.setInvokableClass(BackPressuredTask.class);
	TEST_JOB_VERTEX.setParallelism(JOB_PARALLELISM);

	jobGraph.addVertex(TEST_JOB_VERTEX);
	return jobGraph;
}
 
Example 3
Source File: BackPressureStatsTrackerImplITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static JobGraph createJobWithoutBackPressure() {
	final JobGraph jobGraph = new JobGraph(TEST_JOB_ID, "Test Job");

	TEST_JOB_VERTEX.setInvokableClass(BlockingNoOpInvokable.class);
	TEST_JOB_VERTEX.setParallelism(JOB_PARALLELISM);

	jobGraph.addVertex(TEST_JOB_VERTEX);
	return jobGraph;
}
 
Example 4
Source File: JobITestUtil.java    From AthenaX with Apache License 2.0 5 votes vote down vote up
static JobGraph trivialJobGraph() {
  JobGraph g = new JobGraph();
  JobVertex v = new JobVertex("1");
  v.setInvokableClass(DummyInvokable.class);
  g.addVertex(v);
  return g;
}
 
Example 5
Source File: DefaultSchedulerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private static JobGraph singleJobVertexJobGraph(final int parallelism) {
	final JobGraph jobGraph = new JobGraph(TEST_JOB_ID, "Testjob");
	jobGraph.setScheduleMode(ScheduleMode.EAGER);
	final JobVertex vertex = new JobVertex("source");
	vertex.setInvokableClass(NoOpInvokable.class);
	vertex.setParallelism(parallelism);
	jobGraph.addVertex(vertex);
	return jobGraph;
}
 
Example 6
Source File: ExecutionTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that incomplete futures returned by {@link ShuffleMaster#registerPartitionWithProducer} are rejected.
 */
@Test
public void testIncompletePartitionRegistrationFutureIsRejected() throws Exception {
	final ShuffleMaster<ShuffleDescriptor> shuffleMaster = new TestingShuffleMaster();
	final JobGraph jobGraph = new JobGraph("job graph");
	final JobVertex source = new JobVertex("source");
	final JobVertex target = new JobVertex("target");

	source.setInvokableClass(AbstractInvokable.class);
	target.setInvokableClass(AbstractInvokable.class);
	target.connectNewDataSetAsInput(source, POINTWISE, PIPELINED);
	jobGraph.addVertex(source);
	jobGraph.addVertex(target);
	ExecutionGraph executionGraph = TestingExecutionGraphBuilder
		.newBuilder()
		.setJobGraph(jobGraph)
		.setShuffleMaster(shuffleMaster)
		.build();

	final ExecutionVertex sourceVertex = executionGraph.getAllVertices().get(source.getID()).getTaskVertices()[0];

	boolean incompletePartitionRegistrationRejected = false;
	try {
		Execution.registerProducedPartitions(sourceVertex, new LocalTaskManagerLocation(), new ExecutionAttemptID(), false);
	} catch (IllegalStateException e) {
		incompletePartitionRegistrationRejected = true;
	}

	assertTrue(incompletePartitionRegistrationRejected);
}
 
Example 7
Source File: PerJobMiniClusterFactoryTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private static JobGraph getNoopJobGraph() {
	JobGraph jobGraph = new JobGraph();
	JobVertex jobVertex = new JobVertex("jobVertex");
	jobVertex.setInvokableClass(NoOpInvokable.class);
	jobGraph.addVertex(jobVertex);
	return jobGraph;
}
 
Example 8
Source File: PerJobMiniClusterFactoryTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private static JobGraph getCancellableJobGraph() {
	JobGraph jobGraph = new JobGraph();
	JobVertex jobVertex = new JobVertex("jobVertex");
	jobVertex.setInvokableClass(MyCancellableInvokable.class);
	jobGraph.addVertex(jobVertex);
	return jobGraph;
}
 
Example 9
Source File: ZooKeeperSubmittedJobGraphsStoreITCase.java    From Flink-CEPplus with Apache License 2.0 3 votes vote down vote up
private SubmittedJobGraph createSubmittedJobGraph(JobID jobId, String jobName) {
	final JobGraph jobGraph = new JobGraph(jobId, jobName);

	final JobVertex jobVertex = new JobVertex("Test JobVertex");
	jobVertex.setParallelism(1);

	jobGraph.addVertex(jobVertex);

	return new SubmittedJobGraph(jobGraph);
}
 
Example 10
Source File: ZooKeeperSubmittedJobGraphsStoreITCase.java    From flink with Apache License 2.0 3 votes vote down vote up
private SubmittedJobGraph createSubmittedJobGraph(JobID jobId, String jobName) {
	final JobGraph jobGraph = new JobGraph(jobId, jobName);

	final JobVertex jobVertex = new JobVertex("Test JobVertex");
	jobVertex.setParallelism(1);

	jobGraph.addVertex(jobVertex);

	return new SubmittedJobGraph(jobGraph);
}
 
Example 11
Source File: ZooKeeperJobGraphsStoreITCase.java    From flink with Apache License 2.0 3 votes vote down vote up
private JobGraph createJobGraph(JobID jobId, String jobName) {
	final JobGraph jobGraph = new JobGraph(jobId, jobName);

	final JobVertex jobVertex = new JobVertex("Test JobVertex");
	jobVertex.setParallelism(1);

	jobGraph.addVertex(jobVertex);

	return jobGraph;
}