Java Code Examples for org.apache.flink.runtime.jobmanager.slots.TaskManagerGateway#updatePartitions()

The following examples show how to use org.apache.flink.runtime.jobmanager.slots.TaskManagerGateway#updatePartitions() . 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: Execution.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Update the partition infos on the assigned resource.
 *
 * @param partitionInfos for the remote task
 */
private void sendUpdatePartitionInfoRpcCall(
		final Iterable<PartitionInfo> partitionInfos) {

	final LogicalSlot slot = assignedResource;

	if (slot != null) {
		final TaskManagerGateway taskManagerGateway = slot.getTaskManagerGateway();
		final TaskManagerLocation taskManagerLocation = slot.getTaskManagerLocation();

		CompletableFuture<Acknowledge> updatePartitionsResultFuture = taskManagerGateway.updatePartitions(attemptId, partitionInfos, rpcTimeout);

		updatePartitionsResultFuture.whenCompleteAsync(
			(ack, failure) -> {
				// fail if there was a failure
				if (failure != null) {
					fail(new IllegalStateException("Update task on TaskManager " + taskManagerLocation +
						" failed due to:", failure));
				}
			}, getVertex().getExecutionGraph().getJobMasterMainThreadExecutor());
	}
}
 
Example 2
Source File: Execution.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Update the partition infos on the assigned resource.
 *
 * @param partitionInfos for the remote task
 */
private void sendUpdatePartitionInfoRpcCall(
		final Iterable<PartitionInfo> partitionInfos) {

	final LogicalSlot slot = assignedResource;

	if (slot != null) {
		final TaskManagerGateway taskManagerGateway = slot.getTaskManagerGateway();
		final TaskManagerLocation taskManagerLocation = slot.getTaskManagerLocation();

		CompletableFuture<Acknowledge> updatePartitionsResultFuture = taskManagerGateway.updatePartitions(attemptId, partitionInfos, rpcTimeout);

		updatePartitionsResultFuture.whenCompleteAsync(
			(ack, failure) -> {
				// fail if there was a failure
				if (failure != null) {
					fail(new IllegalStateException("Update task on TaskManager " + taskManagerLocation +
						" failed due to:", failure));
				}
			}, getVertex().getExecutionGraph().getJobMasterMainThreadExecutor());
	}
}
 
Example 3
Source File: Execution.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Update the partition infos on the assigned resource.
 *
 * @param partitionInfos for the remote task
 */
private void sendUpdatePartitionInfoRpcCall(
		final Iterable<PartitionInfo> partitionInfos) {

	final LogicalSlot slot = assignedResource;

	if (slot != null) {
		final TaskManagerGateway taskManagerGateway = slot.getTaskManagerGateway();
		final TaskManagerLocation taskManagerLocation = slot.getTaskManagerLocation();

		CompletableFuture<Acknowledge> updatePartitionsResultFuture = taskManagerGateway.updatePartitions(attemptId, partitionInfos, rpcTimeout);

		updatePartitionsResultFuture.whenCompleteAsync(
			(ack, failure) -> {
				// fail if there was a failure
				if (failure != null) {
					fail(new IllegalStateException("Update to task [" + getVertexWithAttempt() +
						"] on TaskManager " + taskManagerLocation + " failed", failure));
				}
			}, getVertex().getExecutionGraph().getJobMasterMainThreadExecutor());
	}
}