本文整理汇总了Java中org.apache.flink.runtime.jobgraph.JobGraph.addVertex方法的典型用法代码示例。如果您正苦于以下问题:Java JobGraph.addVertex方法的具体用法?Java JobGraph.addVertex怎么用?Java JobGraph.addVertex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.runtime.jobgraph.JobGraph
的用法示例。
在下文中一共展示了JobGraph.addVertex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: trivialJobGraph
import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
static JobGraph trivialJobGraph() {
JobGraph g = new JobGraph();
JobVertex v = new JobVertex("1");
v.setInvokableClass(DummyInvokable.class);
g.addVertex(v);
return g;
}
示例2: createBlockingJobGraph
import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
/**
* Creates a simple blocking JobGraph.
*/
private static JobGraph createBlockingJobGraph() {
JobGraph jobGraph = new JobGraph("Blocking program");
JobVertex jobVertex = new JobVertex("Blocking Vertex");
jobVertex.setInvokableClass(BlockingNoOpInvokable.class);
jobGraph.addVertex(jobVertex);
return jobGraph;
}
示例3: testCancelUnion
import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
@Test
public void testCancelUnion() throws Exception {
// Test config
int numberOfSources = 8;
int sourceParallelism = 4;
TestingCluster flink = null;
try {
// Start a cluster for the given test config
final Configuration config = new Configuration();
config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 2);
config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, sourceParallelism);
config.setString(ConfigConstants.AKKA_ASK_TIMEOUT, TestingUtils.DEFAULT_AKKA_ASK_TIMEOUT());
config.setInteger(ConfigConstants.TASK_MANAGER_MEMORY_SEGMENT_SIZE_KEY, 4096);
config.setInteger(ConfigConstants.TASK_MANAGER_NETWORK_NUM_BUFFERS_KEY, 2048);
flink = new TestingCluster(config, false);
flink.start();
// Setup
final JobGraph jobGraph = new JobGraph("Cancel Big Union");
JobVertex[] sources = new JobVertex[numberOfSources];
SlotSharingGroup group = new SlotSharingGroup();
// Create multiple sources
for (int i = 0; i < sources.length; i++) {
sources[i] = new JobVertex("Source " + i);
sources[i].setInvokableClass(InfiniteSource.class);
sources[i].setParallelism(sourceParallelism);
sources[i].setSlotSharingGroup(group);
jobGraph.addVertex(sources[i]);
group.addVertexToGroup(sources[i].getID());
}
// Union all sources
JobVertex union = new JobVertex("Union");
union.setInvokableClass(AgnosticUnion.class);
union.setParallelism(sourceParallelism);
jobGraph.addVertex(union);
// Each source creates a separate result
for (JobVertex source : sources) {
union.connectNewDataSetAsInput(
source,
DistributionPattern.POINTWISE,
ResultPartitionType.PIPELINED);
}
// run the job
flink.submitJobDetached(jobGraph);
// Wait for the job to make some progress and then cancel
awaitRunning(
flink.getLeaderGateway(TestingUtils.TESTING_DURATION()),
jobGraph.getJobID(),
TestingUtils.TESTING_DURATION());
Thread.sleep(5000);
cancelJob(
flink.getLeaderGateway(TestingUtils.TESTING_DURATION()),
jobGraph.getJobID(),
TestingUtils.TESTING_DURATION());
// Wait for the job to be cancelled
JobManagerActorTestUtils.waitForJobStatus(jobGraph.getJobID(), JobStatus.CANCELED,
flink.getLeaderGateway(TestingUtils.TESTING_DURATION()),
TestingUtils.TESTING_DURATION());
}
finally {
if (flink != null) {
flink.shutdown();
}
}
}
示例4: createSubmittedJobGraph
import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
private SubmittedJobGraph createSubmittedJobGraph(JobID jobId, long start) {
final JobGraph jobGraph = new JobGraph(jobId, "Test JobGraph");
final JobVertex jobVertex = new JobVertex("Test JobVertex");
jobVertex.setParallelism(1);
jobGraph.addVertex(jobVertex);
final JobInfo jobInfo = new JobInfo(
ActorRef.noSender(), ListeningBehaviour.DETACHED, start, Integer.MAX_VALUE);
return new SubmittedJobGraph(jobGraph, jobInfo);
}