Java Code Examples for org.apache.flink.runtime.jobmaster.LogicalSlot#getTaskManagerLocation()

The following examples show how to use org.apache.flink.runtime.jobmaster.LogicalSlot#getTaskManagerLocation() . 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());
	}
}
 
Example 4
Source File: SimpleSlotProvider.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void returnLogicalSlot(LogicalSlot logicalSlot) {
	synchronized (lock) {
		SimpleSlotContext as = new SimpleSlotContext(
			logicalSlot.getAllocationId(),
			logicalSlot.getTaskManagerLocation(),
			logicalSlot.getPhysicalSlotNumber(),
			logicalSlot.getTaskManagerGateway(),
			ResourceProfile.UNKNOWN);

		slots.add(as);
		allocatedSlots.remove(logicalSlot.getSlotRequestId());
	}
}
 
Example 5
Source File: SimpleSlotProvider.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void returnLogicalSlot(LogicalSlot logicalSlot) {
	synchronized (lock) {
		SimpleSlotContext as = new SimpleSlotContext(
			logicalSlot.getAllocationId(),
			logicalSlot.getTaskManagerLocation(),
			logicalSlot.getPhysicalSlotNumber(),
			logicalSlot.getTaskManagerGateway(),
			ResourceProfile.ANY);

		slots.add(as);
		allocatedSlots.remove(logicalSlot.getSlotRequestId());
	}
}
 
Example 6
Source File: Execution.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public TaskManagerLocation getAssignedResourceLocation() {
	// returns non-null only when a location is already assigned
	final LogicalSlot currentAssignedResource = assignedResource;
	return currentAssignedResource != null ? currentAssignedResource.getTaskManagerLocation() : null;
}
 
Example 7
Source File: Execution.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TaskManagerLocation getAssignedResourceLocation() {
	// returns non-null only when a location is already assigned
	final LogicalSlot currentAssignedResource = assignedResource;
	return currentAssignedResource != null ? currentAssignedResource.getTaskManagerLocation() : null;
}
 
Example 8
Source File: Execution.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TaskManagerLocation getAssignedResourceLocation() {
	// returns non-null only when a location is already assigned
	final LogicalSlot currentAssignedResource = assignedResource;
	return currentAssignedResource != null ? currentAssignedResource.getTaskManagerLocation() : null;
}