// create job graph
final JobGraph jg = new JobGraph("Job Graph 1");
jobID = jg.getJobID();
// input vertex
final JobFileInputVertex i1 = new JobFileInputVertex("Input 1", jg);
i1.setFileInputClass(FileLineReader.class);
i1.setFilePath(new Path(inputFile1.toURI()));
i1.setNumberOfSubtasks(4);
i1.setNumberOfSubtasksPerInstance(2);
final JobFileInputVertex i2 = new JobFileInputVertex("Input 2", jg);
i2.setFileInputClass(FileLineReader.class);
i2.setFilePath(new Path(inputFile2.toURI()));
i2.setNumberOfSubtasks(4);
i2.setNumberOfSubtasksPerInstance(2);
// task vertex
final JobTaskVertex t1 = new JobTaskVertex("Task 1", jg);
t1.setTaskClass(ForwardTask1Input1Output.class);
t1.setNumberOfSubtasks(4);
t1.setNumberOfSubtasksPerInstance(2);
final JobTaskVertex t2 = new JobTaskVertex("Task 2", jg);
t2.setTaskClass(ForwardTask1Input1Output.class);
t2.setNumberOfSubtasks(4);
t2.setNumberOfSubtasksPerInstance(2);
final JobTaskVertex t3 = new JobTaskVertex("Task 3", jg);
t3.setTaskClass(ForwardTask2Inputs1Output.class);
t3.setNumberOfSubtasks(8);
t3.setNumberOfSubtasksPerInstance(4);
final JobTaskVertex t4 = new JobTaskVertex("Task 4", jg);
t4.setTaskClass(ForwardTask1Input2Outputs.class);
t4.setNumberOfSubtasks(8);
t4.setNumberOfSubtasksPerInstance(4);
// output vertex
final JobFileOutputVertex o1 = new JobFileOutputVertex("Output 1", jg);
o1.setFileOutputClass(FileLineWriter.class);
o1.setFilePath(new Path(outputFile1.toURI()));
o1.setNumberOfSubtasks(4);
o1.setNumberOfSubtasksPerInstance(2);
final JobFileOutputVertex o2 = new JobFileOutputVertex("Output 2", jg);
o2.setFileOutputClass(FileLineWriter.class);
o2.setFilePath(new Path(outputFile2.toURI()));
o2.setNumberOfSubtasks(4);
o2.setNumberOfSubtasksPerInstance(2);
o1.setVertexToShareInstancesWith(o2);
// connect vertices
i1.connectTo(t1, ChannelType.IN_MEMORY, DistributionPattern.POINTWISE);
i2.connectTo(t2, ChannelType.IN_MEMORY, DistributionPattern.POINTWISE);
t1.connectTo(t3, ChannelType.NETWORK);
t2.connectTo(t3, ChannelType.NETWORK);
t3.connectTo(t4, ChannelType.IN_MEMORY, DistributionPattern.POINTWISE);
t4.connectTo(o1, ChannelType.NETWORK);
t4.connectTo(o2, ChannelType.NETWORK);