org.apache.flink.runtime.resourcemanager.registration.WorkerRegistration Java Examples

The following examples show how to use org.apache.flink.runtime.resourcemanager.registration.WorkerRegistration. 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: ResourceManager.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public void notifySlotAvailable(
		final InstanceID instanceID,
		final SlotID slotId,
		final AllocationID allocationId) {

	final ResourceID resourceId = slotId.getResourceID();
	WorkerRegistration<WorkerType> registration = taskExecutors.get(resourceId);

	if (registration != null) {
		InstanceID registrationId = registration.getInstanceID();

		if (Objects.equals(registrationId, instanceID)) {
			slotManager.freeSlot(slotId, allocationId);
		} else {
			log.debug("Invalid registration id for slot available message. This indicates an" +
				" outdated request.");
		}
	} else {
		log.debug("Could not find registration for resource id {}. Discarding the slot available" +
			"message {}.", resourceId, slotId);
	}
}
 
Example #2
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
protected void releaseResource(InstanceID instanceId, Exception cause) {
	WorkerType worker = null;

	// TODO: Improve performance by having an index on the instanceId
	for (Map.Entry<ResourceID, WorkerRegistration<WorkerType>> entry : taskExecutors.entrySet()) {
		if (entry.getValue().getInstanceID().equals(instanceId)) {
			worker = entry.getValue().getWorker();
			break;
		}
	}

	if (worker != null) {
		if (stopWorker(worker)) {
			closeTaskManagerConnection(worker.getResourceID(), cause);
		} else {
			log.debug("Worker {} could not be stopped.", worker.getResourceID());
		}
	} else {
		// unregister in order to clean up potential left over state
		slotManager.unregisterTaskManager(instanceId, cause);
	}
}
 
Example #3
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * This method should be called by the framework once it detects that a currently registered
 * task executor has failed.
 *
 * @param resourceID Id of the TaskManager that has failed.
 * @param cause The exception which cause the TaskManager failed.
 */
protected void closeTaskManagerConnection(final ResourceID resourceID, final Exception cause) {
	taskManagerHeartbeatManager.unmonitorTarget(resourceID);

	WorkerRegistration<WorkerType> workerRegistration = taskExecutors.remove(resourceID);

	if (workerRegistration != null) {
		log.info("Closing TaskExecutor connection {} because: {}", resourceID, cause.getMessage());

		// TODO :: suggest failed task executor to stop itself
		slotManager.unregisterTaskManager(workerRegistration.getInstanceID(), cause);
		clusterPartitionTracker.processTaskExecutorShutdown(resourceID);

		workerRegistration.getTaskExecutorGateway().disconnectResourceManager(cause);
	} else {
		log.debug(
			"No open TaskExecutor connection {}. Ignoring close TaskExecutor connection. Closing reason was: {}",
			resourceID,
			cause.getMessage());
	}
}
 
Example #4
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<Collection<Tuple2<ResourceID, String>>> requestTaskManagerMetricQueryServiceAddresses(Time timeout) {
	final ArrayList<CompletableFuture<Optional<Tuple2<ResourceID, String>>>> metricQueryServiceAddressFutures = new ArrayList<>(taskExecutors.size());

	for (Map.Entry<ResourceID, WorkerRegistration<WorkerType>> workerRegistrationEntry : taskExecutors.entrySet()) {
		final ResourceID tmResourceId = workerRegistrationEntry.getKey();
		final WorkerRegistration<WorkerType> workerRegistration = workerRegistrationEntry.getValue();
		final TaskExecutorGateway taskExecutorGateway = workerRegistration.getTaskExecutorGateway();

		final CompletableFuture<Optional<Tuple2<ResourceID, String>>> metricQueryServiceAddressFuture = taskExecutorGateway
			.requestMetricQueryServiceAddress(timeout)
			.thenApply(o -> o.toOptional().map(address -> Tuple2.of(tmResourceId, address)));

		metricQueryServiceAddressFutures.add(metricQueryServiceAddressFuture);
	}

	return FutureUtils.combineAll(metricQueryServiceAddressFutures).thenApply(
		collection -> collection
			.stream()
			.filter(Optional::isPresent)
			.map(Optional::get)
			.collect(Collectors.toList()));
}
 
Example #5
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<TaskManagerInfo> requestTaskManagerInfo(ResourceID resourceId, Time timeout) {

	final WorkerRegistration<WorkerType> taskExecutor = taskExecutors.get(resourceId);

	if (taskExecutor == null) {
		return FutureUtils.completedExceptionally(new UnknownTaskExecutorException(resourceId));
	} else {
		final InstanceID instanceId = taskExecutor.getInstanceID();
		final TaskManagerInfo taskManagerInfo = new TaskManagerInfo(
			resourceId,
			taskExecutor.getTaskExecutorGateway().getAddress(),
			taskExecutor.getDataPort(),
			taskManagerHeartbeatManager.getLastHeartbeatFrom(resourceId),
			slotManager.getNumberRegisteredSlotsOf(instanceId),
			slotManager.getNumberFreeSlotsOf(instanceId),
			slotManager.getRegisteredResourceOf(instanceId),
			slotManager.getFreeResourceOf(instanceId),
			taskExecutor.getHardwareDescription());

		return CompletableFuture.completedFuture(taskManagerInfo);
	}
}
 
Example #6
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<Collection<TaskManagerInfo>> requestTaskManagerInfo(Time timeout) {

	final ArrayList<TaskManagerInfo> taskManagerInfos = new ArrayList<>(taskExecutors.size());

	for (Map.Entry<ResourceID, WorkerRegistration<WorkerType>> taskExecutorEntry : taskExecutors.entrySet()) {
		final ResourceID resourceId = taskExecutorEntry.getKey();
		final WorkerRegistration<WorkerType> taskExecutor = taskExecutorEntry.getValue();

		taskManagerInfos.add(
			new TaskManagerInfo(
				resourceId,
				taskExecutor.getTaskExecutorGateway().getAddress(),
				taskExecutor.getDataPort(),
				taskManagerHeartbeatManager.getLastHeartbeatFrom(resourceId),
				slotManager.getNumberRegisteredSlotsOf(taskExecutor.getInstanceID()),
				slotManager.getNumberFreeSlotsOf(taskExecutor.getInstanceID()),
				slotManager.getRegisteredResourceOf(taskExecutor.getInstanceID()),
				slotManager.getFreeResourceOf(taskExecutor.getInstanceID()),
				taskExecutor.getHardwareDescription()));
	}

	return CompletableFuture.completedFuture(taskManagerInfos);
}
 
Example #7
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void notifySlotAvailable(
		final InstanceID instanceID,
		final SlotID slotId,
		final AllocationID allocationId) {

	final ResourceID resourceId = slotId.getResourceID();
	WorkerRegistration<WorkerType> registration = taskExecutors.get(resourceId);

	if (registration != null) {
		InstanceID registrationId = registration.getInstanceID();

		if (Objects.equals(registrationId, instanceID)) {
			slotManager.freeSlot(slotId, allocationId);
		} else {
			log.debug("Invalid registration id for slot available message. This indicates an" +
				" outdated request.");
		}
	} else {
		log.debug("Could not find registration for resource id {}. Discarding the slot available" +
			"message {}.", resourceId, slotId);
	}
}
 
Example #8
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
protected void releaseResource(InstanceID instanceId, Exception cause) {
	WorkerType worker = null;

	// TODO: Improve performance by having an index on the instanceId
	for (Map.Entry<ResourceID, WorkerRegistration<WorkerType>> entry : taskExecutors.entrySet()) {
		if (entry.getValue().getInstanceID().equals(instanceId)) {
			worker = entry.getValue().getWorker();
			break;
		}
	}

	if (worker != null) {
		if (stopWorker(worker)) {
			closeTaskManagerConnection(worker.getResourceID(), cause);
		} else {
			log.debug("Worker {} could not be stopped.", worker.getResourceID());
		}
	} else {
		// unregister in order to clean up potential left over state
		slotManager.unregisterTaskManager(instanceId);
	}
}
 
Example #9
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * This method should be called by the framework once it detects that a currently registered
 * task executor has failed.
 *
 * @param resourceID Id of the TaskManager that has failed.
 * @param cause The exception which cause the TaskManager failed.
 */
protected void closeTaskManagerConnection(final ResourceID resourceID, final Exception cause) {
	taskManagerHeartbeatManager.unmonitorTarget(resourceID);

	WorkerRegistration<WorkerType> workerRegistration = taskExecutors.remove(resourceID);

	if (workerRegistration != null) {
		log.info("Closing TaskExecutor connection {} because: {}", resourceID, cause.getMessage());

		// TODO :: suggest failed task executor to stop itself
		slotManager.unregisterTaskManager(workerRegistration.getInstanceID());

		workerRegistration.getTaskExecutorGateway().disconnectResourceManager(cause);
	} else {
		log.debug(
			"No open TaskExecutor connection {}. Ignoring close TaskExecutor connection. Closing reason was: {}",
			resourceID,
			cause.getMessage());
	}
}
 
Example #10
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<Collection<Tuple2<ResourceID, String>>> requestTaskManagerMetricQueryServiceAddresses(Time timeout) {
	final ArrayList<CompletableFuture<Optional<Tuple2<ResourceID, String>>>> metricQueryServiceAddressFutures = new ArrayList<>(taskExecutors.size());

	for (Map.Entry<ResourceID, WorkerRegistration<WorkerType>> workerRegistrationEntry : taskExecutors.entrySet()) {
		final ResourceID tmResourceId = workerRegistrationEntry.getKey();
		final WorkerRegistration<WorkerType> workerRegistration = workerRegistrationEntry.getValue();
		final TaskExecutorGateway taskExecutorGateway = workerRegistration.getTaskExecutorGateway();

		final CompletableFuture<Optional<Tuple2<ResourceID, String>>> metricQueryServiceAddressFuture = taskExecutorGateway
			.requestMetricQueryServiceAddress(timeout)
			.thenApply(o -> o.toOptional().map(address -> Tuple2.of(tmResourceId, address)));

		metricQueryServiceAddressFutures.add(metricQueryServiceAddressFuture);
	}

	return FutureUtils.combineAll(metricQueryServiceAddressFutures).thenApply(
		collection -> collection
			.stream()
			.filter(Optional::isPresent)
			.map(Optional::get)
			.collect(Collectors.toList()));
}
 
Example #11
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<TaskManagerInfo> requestTaskManagerInfo(ResourceID resourceId, Time timeout) {

	final WorkerRegistration<WorkerType> taskExecutor = taskExecutors.get(resourceId);

	if (taskExecutor == null) {
		return FutureUtils.completedExceptionally(new UnknownTaskExecutorException(resourceId));
	} else {
		final InstanceID instanceId = taskExecutor.getInstanceID();
		final TaskManagerInfo taskManagerInfo = new TaskManagerInfo(
			resourceId,
			taskExecutor.getTaskExecutorGateway().getAddress(),
			taskExecutor.getDataPort(),
			taskManagerHeartbeatManager.getLastHeartbeatFrom(resourceId),
			slotManager.getNumberRegisteredSlotsOf(instanceId),
			slotManager.getNumberFreeSlotsOf(instanceId),
			taskExecutor.getHardwareDescription());

		return CompletableFuture.completedFuture(taskManagerInfo);
	}
}
 
Example #12
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void notifySlotAvailable(
		final InstanceID instanceID,
		final SlotID slotId,
		final AllocationID allocationId) {

	final ResourceID resourceId = slotId.getResourceID();
	WorkerRegistration<WorkerType> registration = taskExecutors.get(resourceId);

	if (registration != null) {
		InstanceID registrationId = registration.getInstanceID();

		if (Objects.equals(registrationId, instanceID)) {
			slotManager.freeSlot(slotId, allocationId);
		} else {
			log.debug("Invalid registration id for slot available message. This indicates an" +
				" outdated request.");
		}
	} else {
		log.debug("Could not find registration for resource id {}. Discarding the slot available" +
			"message {}.", resourceId, slotId);
	}
}
 
Example #13
Source File: ResourceManager.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<Collection<TaskManagerInfo>> requestTaskManagerInfo(Time timeout) {

	final ArrayList<TaskManagerInfo> taskManagerInfos = new ArrayList<>(taskExecutors.size());

	for (Map.Entry<ResourceID, WorkerRegistration<WorkerType>> taskExecutorEntry : taskExecutors.entrySet()) {
		final ResourceID resourceId = taskExecutorEntry.getKey();
		final WorkerRegistration<WorkerType> taskExecutor = taskExecutorEntry.getValue();

		taskManagerInfos.add(
			new TaskManagerInfo(
				resourceId,
				taskExecutor.getTaskExecutorGateway().getAddress(),
				taskExecutor.getDataPort(),
				taskManagerHeartbeatManager.getLastHeartbeatFrom(resourceId),
				slotManager.getNumberRegisteredSlotsOf(taskExecutor.getInstanceID()),
				slotManager.getNumberFreeSlotsOf(taskExecutor.getInstanceID()),
				taskExecutor.getHardwareDescription()));
	}

	return CompletableFuture.completedFuture(taskManagerInfos);
}
 
Example #14
Source File: ResourceManager.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
protected void releaseResource(InstanceID instanceId, Exception cause) {
	WorkerType worker = null;

	// TODO: Improve performance by having an index on the instanceId
	for (Map.Entry<ResourceID, WorkerRegistration<WorkerType>> entry : taskExecutors.entrySet()) {
		if (entry.getValue().getInstanceID().equals(instanceId)) {
			worker = entry.getValue().getWorker();
			break;
		}
	}

	if (worker != null) {
		if (stopWorker(worker)) {
			closeTaskManagerConnection(worker.getResourceID(), cause);
		} else {
			log.debug("Worker {} could not be stopped.", worker.getResourceID());
		}
	} else {
		// unregister in order to clean up potential left over state
		slotManager.unregisterTaskManager(instanceId);
	}
}
 
Example #15
Source File: ResourceManager.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * This method should be called by the framework once it detects that a currently registered
 * task executor has failed.
 *
 * @param resourceID Id of the TaskManager that has failed.
 * @param cause The exception which cause the TaskManager failed.
 */
protected void closeTaskManagerConnection(final ResourceID resourceID, final Exception cause) {
	taskManagerHeartbeatManager.unmonitorTarget(resourceID);

	WorkerRegistration<WorkerType> workerRegistration = taskExecutors.remove(resourceID);

	if (workerRegistration != null) {
		log.info("Closing TaskExecutor connection {} because: {}", resourceID, cause.getMessage());

		// TODO :: suggest failed task executor to stop itself
		slotManager.unregisterTaskManager(workerRegistration.getInstanceID());

		workerRegistration.getTaskExecutorGateway().disconnectResourceManager(cause);
	} else {
		log.debug(
			"No open TaskExecutor connection {}. Ignoring close TaskExecutor connection. Closing reason was: {}",
			resourceID,
			cause.getMessage());
	}
}
 
Example #16
Source File: ResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<Collection<TaskManagerInfo>> requestTaskManagerInfo(Time timeout) {

	final ArrayList<TaskManagerInfo> taskManagerInfos = new ArrayList<>(taskExecutors.size());

	for (Map.Entry<ResourceID, WorkerRegistration<WorkerType>> taskExecutorEntry : taskExecutors.entrySet()) {
		final ResourceID resourceId = taskExecutorEntry.getKey();
		final WorkerRegistration<WorkerType> taskExecutor = taskExecutorEntry.getValue();

		taskManagerInfos.add(
			new TaskManagerInfo(
				resourceId,
				taskExecutor.getTaskExecutorGateway().getAddress(),
				taskExecutor.getDataPort(),
				taskManagerHeartbeatManager.getLastHeartbeatFrom(resourceId),
				slotManager.getNumberRegisteredSlotsOf(taskExecutor.getInstanceID()),
				slotManager.getNumberFreeSlotsOf(taskExecutor.getInstanceID()),
				taskExecutor.getHardwareDescription()));
	}

	return CompletableFuture.completedFuture(taskManagerInfos);
}
 
Example #17
Source File: ResourceManager.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<Collection<Tuple2<ResourceID, String>>> requestTaskManagerMetricQueryServicePaths(Time timeout) {
	final ArrayList<CompletableFuture<Optional<Tuple2<ResourceID, String>>>> metricQueryServicePathFutures = new ArrayList<>(taskExecutors.size());

	for (Map.Entry<ResourceID, WorkerRegistration<WorkerType>> workerRegistrationEntry : taskExecutors.entrySet()) {
		final ResourceID tmResourceId = workerRegistrationEntry.getKey();
		final WorkerRegistration<WorkerType> workerRegistration = workerRegistrationEntry.getValue();
		final TaskExecutorGateway taskExecutorGateway = workerRegistration.getTaskExecutorGateway();

		final CompletableFuture<Optional<Tuple2<ResourceID, String>>> metricQueryServicePathFuture = taskExecutorGateway
			.requestMetricQueryServiceAddress(timeout)
			.thenApply(optional -> optional.map(path -> Tuple2.of(tmResourceId, path)));

		metricQueryServicePathFutures.add(metricQueryServicePathFuture);
	}

	return FutureUtils.combineAll(metricQueryServicePathFutures).thenApply(
		collection -> collection
			.stream()
			.filter(Optional::isPresent)
			.map(Optional::get)
			.collect(Collectors.toList()));
}
 
Example #18
Source File: ResourceManager.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<TaskManagerInfo> requestTaskManagerInfo(ResourceID resourceId, Time timeout) {

	final WorkerRegistration<WorkerType> taskExecutor = taskExecutors.get(resourceId);

	if (taskExecutor == null) {
		return FutureUtils.completedExceptionally(new UnknownTaskExecutorException(resourceId));
	} else {
		final InstanceID instanceId = taskExecutor.getInstanceID();
		final TaskManagerInfo taskManagerInfo = new TaskManagerInfo(
			resourceId,
			taskExecutor.getTaskExecutorGateway().getAddress(),
			taskExecutor.getDataPort(),
			taskManagerHeartbeatManager.getLastHeartbeatFrom(resourceId),
			slotManager.getNumberRegisteredSlotsOf(instanceId),
			slotManager.getNumberFreeSlotsOf(instanceId),
			taskExecutor.getHardwareDescription());

		return CompletableFuture.completedFuture(taskManagerInfo);
	}
}
 
Example #19
Source File: ResourceManager.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<TransientBlobKey> requestTaskManagerFileUpload(ResourceID taskManagerId, FileType fileType, Time timeout) {
	log.debug("Request file {} upload from TaskExecutor {}.", fileType, taskManagerId);

	final WorkerRegistration<WorkerType> taskExecutor = taskExecutors.get(taskManagerId);

	if (taskExecutor == null) {
		log.debug("Requested file {} upload from unregistered TaskExecutor {}.", fileType, taskManagerId);
		return FutureUtils.completedExceptionally(new UnknownTaskExecutorException(taskManagerId));
	} else {
		return taskExecutor.getTaskExecutorGateway().requestFileUpload(fileType, timeout);
	}
}
 
Example #20
Source File: ResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void reportPayload(final ResourceID resourceID, final TaskExecutorHeartbeatPayload payload) {
	validateRunsInMainThread();
	final WorkerRegistration<WorkerType> workerRegistration = taskExecutors.get(resourceID);

	if (workerRegistration == null) {
		log.debug("Received slot report from TaskManager {} which is no longer registered.", resourceID);
	} else {
		InstanceID instanceId = workerRegistration.getInstanceID();

		slotManager.reportSlotStatus(instanceId, payload.getSlotReport());
		clusterPartitionTracker.processTaskExecutorClusterPartitionReport(resourceID, payload.getClusterPartitionReport());
	}
}
 
Example #21
Source File: ResourceManager.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<Acknowledge> sendSlotReport(ResourceID taskManagerResourceId, InstanceID taskManagerRegistrationId, SlotReport slotReport, Time timeout) {
	final WorkerRegistration<WorkerType> workerTypeWorkerRegistration = taskExecutors.get(taskManagerResourceId);

	if (workerTypeWorkerRegistration.getInstanceID().equals(taskManagerRegistrationId)) {
		slotManager.registerTaskManager(workerTypeWorkerRegistration, slotReport);
		return CompletableFuture.completedFuture(Acknowledge.get());
	} else {
		return FutureUtils.completedExceptionally(new ResourceManagerException(String.format("Unknown TaskManager registration id %s.", taskManagerRegistrationId)));
	}
}
 
Example #22
Source File: ResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<ThreadDumpInfo> requestThreadDump(ResourceID taskManagerId, Time timeout) {
	final WorkerRegistration<WorkerType> taskExecutor = taskExecutors.get(taskManagerId);

	if (taskExecutor == null) {
		log.debug("Requested thread dump from unregistered TaskExecutor {}.", taskManagerId);
		return FutureUtils.completedExceptionally(new UnknownTaskExecutorException(taskManagerId));
	} else {
		return taskExecutor.getTaskExecutorGateway().requestThreadDump(timeout);
	}

}
 
Example #23
Source File: ResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<Collection<LogInfo>> requestTaskManagerLogList(ResourceID taskManagerId, Time timeout) {
	final WorkerRegistration<WorkerType> taskExecutor = taskExecutors.get(taskManagerId);
	if (taskExecutor == null) {
		log.debug("Requested log list from unregistered TaskExecutor {}.", taskManagerId);
		return FutureUtils.completedExceptionally(new UnknownTaskExecutorException(taskManagerId));
	} else {
		return taskExecutor.getTaskExecutorGateway().requestLogList(timeout);
	}
}
 
Example #24
Source File: ResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<TransientBlobKey> requestTaskManagerFileUploadByName(ResourceID taskManagerId, String fileName, Time timeout) {
	log.debug("Request upload of file {} from TaskExecutor {}.", fileName, taskManagerId);

	final WorkerRegistration<WorkerType> taskExecutor = taskExecutors.get(taskManagerId);

	if (taskExecutor == null) {
		log.debug("Request upload of file {} from unregistered TaskExecutor {}.", fileName, taskManagerId);
		return FutureUtils.completedExceptionally(new UnknownTaskExecutorException(taskManagerId));
	} else {
		return taskExecutor.getTaskExecutorGateway().requestFileUploadByName(fileName, timeout);
	}
}
 
Example #25
Source File: ResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<TransientBlobKey> requestTaskManagerFileUploadByType(ResourceID taskManagerId, FileType fileType, Time timeout) {
	log.debug("Request {} file upload from TaskExecutor {}.", fileType, taskManagerId);

	final WorkerRegistration<WorkerType> taskExecutor = taskExecutors.get(taskManagerId);

	if (taskExecutor == null) {
		log.debug("Request upload of file {} from unregistered TaskExecutor {}.", fileType, taskManagerId);
		return FutureUtils.completedExceptionally(new UnknownTaskExecutorException(taskManagerId));
	} else {
		return taskExecutor.getTaskExecutorGateway().requestFileUploadByType(fileType, timeout);
	}
}
 
Example #26
Source File: ResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<Acknowledge> sendSlotReport(ResourceID taskManagerResourceId, InstanceID taskManagerRegistrationId, SlotReport slotReport, Time timeout) {
	final WorkerRegistration<WorkerType> workerTypeWorkerRegistration = taskExecutors.get(taskManagerResourceId);

	if (workerTypeWorkerRegistration.getInstanceID().equals(taskManagerRegistrationId)) {
		if (slotManager.registerTaskManager(workerTypeWorkerRegistration, slotReport)) {
			onTaskManagerRegistration(workerTypeWorkerRegistration);
		}
		return CompletableFuture.completedFuture(Acknowledge.get());
	} else {
		return FutureUtils.completedExceptionally(new ResourceManagerException(String.format("Unknown TaskManager registration id %s.", taskManagerRegistrationId)));
	}
}
 
Example #27
Source File: ResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void reportPayload(final ResourceID resourceID, final SlotReport payload) {
	validateRunsInMainThread();
	final WorkerRegistration<WorkerType> workerRegistration = taskExecutors.get(resourceID);

	if (workerRegistration == null) {
		log.debug("Received slot report from TaskManager {} which is no longer registered.", resourceID);
	} else {
		InstanceID instanceId = workerRegistration.getInstanceID();

		slotManager.reportSlotStatus(instanceId, payload);
	}
}
 
Example #28
Source File: ResourceManager.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void reportPayload(final ResourceID resourceID, final SlotReport payload) {
	validateRunsInMainThread();
	final WorkerRegistration<WorkerType> workerRegistration = taskExecutors.get(resourceID);

	if (workerRegistration == null) {
		log.debug("Received slot report from TaskManager {} which is no longer registered.", resourceID);
	} else {
		InstanceID instanceId = workerRegistration.getInstanceID();

		slotManager.reportSlotStatus(instanceId, payload);
	}
}
 
Example #29
Source File: ResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<TransientBlobKey> requestTaskManagerFileUpload(ResourceID taskManagerId, FileType fileType, Time timeout) {
	log.debug("Request file {} upload from TaskExecutor {}.", fileType, taskManagerId);

	final WorkerRegistration<WorkerType> taskExecutor = taskExecutors.get(taskManagerId);

	if (taskExecutor == null) {
		log.debug("Requested file {} upload from unregistered TaskExecutor {}.", fileType, taskManagerId);
		return FutureUtils.completedExceptionally(new UnknownTaskExecutorException(taskManagerId));
	} else {
		return taskExecutor.getTaskExecutorGateway().requestFileUpload(fileType, timeout);
	}
}
 
Example #30
Source File: ResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<Acknowledge> sendSlotReport(ResourceID taskManagerResourceId, InstanceID taskManagerRegistrationId, SlotReport slotReport, Time timeout) {
	final WorkerRegistration<WorkerType> workerTypeWorkerRegistration = taskExecutors.get(taskManagerResourceId);

	if (workerTypeWorkerRegistration.getInstanceID().equals(taskManagerRegistrationId)) {
		slotManager.registerTaskManager(workerTypeWorkerRegistration, slotReport);
		return CompletableFuture.completedFuture(Acknowledge.get());
	} else {
		return FutureUtils.completedExceptionally(new ResourceManagerException(String.format("Unknown TaskManager registration id %s.", taskManagerRegistrationId)));
	}
}