Java Code Examples for org.apache.flink.runtime.jobgraph.DistributionPattern#ALL_TO_ALL

The following examples show how to use org.apache.flink.runtime.jobgraph.DistributionPattern#ALL_TO_ALL . 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: JobGraphGenerator.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private int getNumberOfSendersPerReceiver(DistributionPattern pattern, int numSenders, int numReceivers) {
	if (pattern == DistributionPattern.ALL_TO_ALL) {
		return numSenders;
	} else if (pattern == DistributionPattern.POINTWISE) {
		if (numSenders != numReceivers) {
			if (numReceivers == 1) {
				return numSenders;
			}
			else if (numSenders == 1) {
				return 1;
			}
			else {
				throw new CompilerException("Error: A changing parallelism is currently " +
						"not supported between tasks within an iteration.");
			}
		} else {
			return 1;
		}
	} else {
		throw new CompilerException("Unknown distribution pattern for channels: " + pattern);
	}
}
 
Example 2
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 6 votes vote down vote up
private int getNumberOfSendersPerReceiver(DistributionPattern pattern, int numSenders, int numReceivers) {
	if (pattern == DistributionPattern.ALL_TO_ALL) {
		return numSenders;
	} else if (pattern == DistributionPattern.POINTWISE) {
		if (numSenders != numReceivers) {
			if (numReceivers == 1) {
				return numSenders;
			}
			else if (numSenders == 1) {
				return 1;
			}
			else {
				throw new CompilerException("Error: A changing parallelism is currently " +
						"not supported between tasks within an iteration.");
			}
		} else {
			return 1;
		}
	} else {
		throw new CompilerException("Unknown distribution pattern for channels: " + pattern);
	}
}
 
Example 3
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 6 votes vote down vote up
private int getNumberOfSendersPerReceiver(DistributionPattern pattern, int numSenders, int numReceivers) {
	if (pattern == DistributionPattern.ALL_TO_ALL) {
		return numSenders;
	} else if (pattern == DistributionPattern.POINTWISE) {
		if (numSenders != numReceivers) {
			if (numReceivers == 1) {
				return numSenders;
			}
			else if (numSenders == 1) {
				return 1;
			}
			else {
				throw new CompilerException("Error: A changing parallelism is currently " +
						"not supported between tasks within an iteration.");
			}
		} else {
			return 1;
		}
	} else {
		throw new CompilerException("Unknown distribution pattern for channels: " + pattern);
	}
}
 
Example 4
Source File: ExecutionVertexLocalityTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a simple 2 vertex graph with a parallel source and a parallel target.
 */
private ExecutionGraph createTestGraph(int parallelism, boolean allToAll) throws Exception {

	JobVertex source = new JobVertex("source", sourceVertexId);
	source.setParallelism(parallelism);
	source.setInvokableClass(NoOpInvokable.class);

	JobVertex target = new JobVertex("source", targetVertexId);
	target.setParallelism(parallelism);
	target.setInvokableClass(NoOpInvokable.class);

	DistributionPattern connectionPattern = allToAll ? DistributionPattern.ALL_TO_ALL : DistributionPattern.POINTWISE;
	target.connectNewDataSetAsInput(source, connectionPattern, ResultPartitionType.PIPELINED);

	JobGraph testJob = new JobGraph(jobId, "test job", source, target);

	final Time timeout = Time.seconds(10L);
	return ExecutionGraphBuilder.buildGraph(
		null,
		testJob,
		new Configuration(),
		TestingUtils.defaultExecutor(),
		TestingUtils.defaultExecutor(),
		mock(SlotProvider.class),
		getClass().getClassLoader(),
		new StandaloneCheckpointRecoveryFactory(),
		timeout,
		new FixedDelayRestartStrategy(10, 0L),
		new UnregisteredMetricsGroup(),
		1,
		VoidBlobWriter.getInstance(),
		timeout,
		log);
}
 
Example 5
Source File: ExecutionVertexLocalityTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a simple 2 vertex graph with a parallel source and a parallel target.
 */
private ExecutionGraph createTestGraph(int parallelism, boolean allToAll) throws Exception {

	JobVertex source = new JobVertex("source", sourceVertexId);
	source.setParallelism(parallelism);
	source.setInvokableClass(NoOpInvokable.class);

	JobVertex target = new JobVertex("source", targetVertexId);
	target.setParallelism(parallelism);
	target.setInvokableClass(NoOpInvokable.class);

	DistributionPattern connectionPattern = allToAll ? DistributionPattern.ALL_TO_ALL : DistributionPattern.POINTWISE;
	target.connectNewDataSetAsInput(source, connectionPattern, ResultPartitionType.PIPELINED);

	JobGraph testJob = new JobGraph(jobId, "test job", source, target);

	final Time timeout = Time.seconds(10L);
	return ExecutionGraphBuilder.buildGraph(
		null,
		testJob,
		new Configuration(),
		TestingUtils.defaultExecutor(),
		TestingUtils.defaultExecutor(),
		mock(SlotProvider.class),
		getClass().getClassLoader(),
		new StandaloneCheckpointRecoveryFactory(),
		timeout,
		new FixedDelayRestartStrategy(10, 0L),
		new UnregisteredMetricsGroup(),
		VoidBlobWriter.getInstance(),
		timeout,
		log,
		NettyShuffleMaster.INSTANCE,
		NoOpPartitionTracker.INSTANCE);
}
 
Example 6
Source File: ExecutionVertexLocalityTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a simple 2 vertex graph with a parallel source and a parallel target.
 */
private ExecutionGraph createTestGraph(int parallelism, boolean allToAll) throws Exception {

	JobVertex source = new JobVertex("source", sourceVertexId);
	source.setParallelism(parallelism);
	source.setInvokableClass(NoOpInvokable.class);

	JobVertex target = new JobVertex("source", targetVertexId);
	target.setParallelism(parallelism);
	target.setInvokableClass(NoOpInvokable.class);

	DistributionPattern connectionPattern = allToAll ? DistributionPattern.ALL_TO_ALL : DistributionPattern.POINTWISE;
	target.connectNewDataSetAsInput(source, connectionPattern, ResultPartitionType.PIPELINED);

	JobGraph testJob = new JobGraph(jobId, "test job", source, target);

	final Time timeout = Time.seconds(10L);
	return ExecutionGraphBuilder.buildGraph(
		null,
		testJob,
		new Configuration(),
		TestingUtils.defaultExecutor(),
		TestingUtils.defaultExecutor(),
		mock(SlotProvider.class),
		getClass().getClassLoader(),
		new StandaloneCheckpointRecoveryFactory(),
		timeout,
		new FixedDelayRestartStrategy(10, 0L),
		new UnregisteredMetricsGroup(),
		VoidBlobWriter.getInstance(),
		timeout,
		log,
		NettyShuffleMaster.INSTANCE,
		NoOpJobMasterPartitionTracker.INSTANCE);
}