org.apache.flink.runtime.resourcemanager.exceptions.UnknownTaskExecutorException Java Examples

The following examples show how to use org.apache.flink.runtime.resourcemanager.exceptions.UnknownTaskExecutorException. 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 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 #2
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 #3
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 #4
Source File: TaskManagerLogListHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<LogListInfo> handleRequest(
		@Nonnull HandlerRequest<EmptyRequestBody, TaskManagerMessageParameters> request,
		@Nonnull ResourceManagerGateway gateway) throws RestHandlerException {
	final ResourceID taskManagerId = request.getPathParameter(TaskManagerIdPathParameter.class);
	final ResourceManagerGateway resourceManagerGateway = getResourceManagerGateway(resourceManagerGatewayRetriever);
	final CompletableFuture<Collection<LogInfo>> logsWithLengthFuture = resourceManagerGateway.requestTaskManagerLogList(taskManagerId, timeout);

	return logsWithLengthFuture.thenApply(LogListInfo::new).exceptionally(
		(throwable) -> {
			final Throwable strippedThrowable = ExceptionUtils.stripCompletionException(throwable);
			if (strippedThrowable instanceof UnknownTaskExecutorException) {
				throw new CompletionException(
					new RestHandlerException(
						"Could not find TaskExecutor " + taskManagerId,
						HttpResponseStatus.NOT_FOUND,
						strippedThrowable
					));
			} else {
				throw new CompletionException(throwable);
			}
		});
}
 
Example #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
Source File: TestingResourceManagerGateway.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 Function<ResourceID, CompletableFuture<Collection<LogInfo>>> function = this.requestTaskManagerLogListFunction;
	if (function != null) {
		return function.apply(taskManagerId);
	} else {
		return FutureUtils.completedExceptionally(new UnknownTaskExecutorException(taskManagerId));
	}
}
 
Example #12
Source File: TestingResourceManagerGateway.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<ThreadDumpInfo> requestThreadDump(ResourceID taskManagerId, Time timeout) {
	final Function<ResourceID, CompletableFuture<ThreadDumpInfo>> function = this.requestThreadDumpFunction;

	if (function != null) {
		return function.apply(taskManagerId);
	} else {
		return FutureUtils.completedExceptionally(new UnknownTaskExecutorException(taskManagerId));
	}
}
 
Example #13
Source File: TaskManagerLogListHandlerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetTaskManagerLogsListForUnknownTaskExecutorException() throws Exception {
	resourceManagerGateway.setRequestTaskManagerLogListFunction(EXPECTED_TASK_MANAGER_ID -> FutureUtils.completedExceptionally(new UnknownTaskExecutorException(EXPECTED_TASK_MANAGER_ID)));
	try {
		taskManagerLogListHandler.handleRequest(handlerRequest, resourceManagerGateway).get();
	} catch (ExecutionException e) {
		final Throwable cause = e.getCause();
		assertThat(cause, is(instanceOf(RestHandlerException.class)));

		final RestHandlerException restHandlerException = (RestHandlerException) cause;
		assertThat(restHandlerException.getHttpResponseStatus(), is(equalTo(HttpResponseStatus.NOT_FOUND)));
		assertThat(restHandlerException.getMessage(), containsString("Could not find TaskExecutor " + EXPECTED_TASK_MANAGER_ID));
	}
}
 
Example #14
Source File: TaskManagerDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
protected CompletableFuture<TaskManagerDetailsInfo> handleRequest(
		@Nonnull HandlerRequest<EmptyRequestBody, TaskManagerMessageParameters> request,
		@Nonnull ResourceManagerGateway gateway) throws RestHandlerException {
	final ResourceID taskManagerResourceId = request.getPathParameter(TaskManagerIdPathParameter
		.class);

	CompletableFuture<TaskManagerInfo> taskManagerInfoFuture = gateway.requestTaskManagerInfo(taskManagerResourceId, timeout);

	metricFetcher.update();

	return taskManagerInfoFuture.thenApply(
		(TaskManagerInfo taskManagerInfo) -> {
			final MetricStore.TaskManagerMetricStore tmMetrics =
				metricStore.getTaskManagerMetricStore(taskManagerResourceId.getResourceIdString());

			final TaskManagerMetricsInfo taskManagerMetricsInfo;

			if (tmMetrics != null) {
				log.debug("Create metrics info for TaskManager {}.", taskManagerResourceId);
				taskManagerMetricsInfo = createTaskManagerMetricsInfo(tmMetrics);
			} else {
				log.debug("No metrics for TaskManager {}.", taskManagerResourceId);
				taskManagerMetricsInfo = TaskManagerMetricsInfo.empty();
			}

			return new TaskManagerDetailsInfo(
				taskManagerInfo,
				taskManagerMetricsInfo);
		})
		.exceptionally(
			(Throwable throwable) -> {
				final Throwable strippedThrowable = ExceptionUtils.stripExecutionException(throwable);

				if (strippedThrowable instanceof UnknownTaskExecutorException) {
					throw new CompletionException(
						new RestHandlerException(
							"Could not find TaskExecutor " + taskManagerResourceId + '.',
							HttpResponseStatus.NOT_FOUND,
							strippedThrowable));
				} else {
					throw new CompletionException(strippedThrowable);
				}
			}
		);
}
 
Example #15
Source File: TaskManagerDetailsHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected CompletableFuture<TaskManagerDetailsInfo> handleRequest(
		@Nonnull HandlerRequest<EmptyRequestBody, TaskManagerMessageParameters> request,
		@Nonnull ResourceManagerGateway gateway) throws RestHandlerException {
	final ResourceID taskManagerResourceId = request.getPathParameter(TaskManagerIdPathParameter
		.class);

	CompletableFuture<TaskManagerInfo> taskManagerInfoFuture = gateway.requestTaskManagerInfo(taskManagerResourceId, timeout);

	metricFetcher.update();

	return taskManagerInfoFuture.thenApply(
		(TaskManagerInfo taskManagerInfo) -> {
			final MetricStore.TaskManagerMetricStore tmMetrics =
				metricStore.getTaskManagerMetricStore(taskManagerResourceId.getResourceIdString());

			final TaskManagerMetricsInfo taskManagerMetricsInfo;

			if (tmMetrics != null) {
				log.debug("Create metrics info for TaskManager {}.", taskManagerResourceId);
				taskManagerMetricsInfo = createTaskManagerMetricsInfo(tmMetrics);
			} else {
				log.debug("No metrics for TaskManager {}.", taskManagerResourceId);
				taskManagerMetricsInfo = TaskManagerMetricsInfo.empty();
			}

			return new TaskManagerDetailsInfo(
				taskManagerInfo,
				taskManagerMetricsInfo);
		})
		.exceptionally(
			(Throwable throwable) -> {
				final Throwable strippedThrowable = ExceptionUtils.stripExecutionException(throwable);

				if (strippedThrowable instanceof UnknownTaskExecutorException) {
					throw new CompletionException(
						new RestHandlerException(
							"Could not find TaskExecutor " + taskManagerResourceId + '.',
							HttpResponseStatus.NOT_FOUND,
							strippedThrowable));
				} else {
					throw new CompletionException(strippedThrowable);
				}
			}
		);
}
 
Example #16
Source File: TaskManagerDetailsHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected CompletableFuture<TaskManagerDetailsInfo> handleRequest(
		@Nonnull HandlerRequest<EmptyRequestBody, TaskManagerMessageParameters> request,
		@Nonnull ResourceManagerGateway gateway) throws RestHandlerException {
	final ResourceID taskManagerResourceId = request.getPathParameter(TaskManagerIdPathParameter
		.class);

	CompletableFuture<TaskManagerInfo> taskManagerInfoFuture = gateway.requestTaskManagerInfo(taskManagerResourceId, timeout);

	metricFetcher.update();

	return taskManagerInfoFuture.thenApply(
		(TaskManagerInfo taskManagerInfo) -> {
			final MetricStore.TaskManagerMetricStore tmMetrics =
				metricStore.getTaskManagerMetricStore(taskManagerResourceId.getResourceIdString());

			final TaskManagerMetricsInfo taskManagerMetricsInfo;

			if (tmMetrics != null) {
				log.debug("Create metrics info for TaskManager {}.", taskManagerResourceId);
				taskManagerMetricsInfo = createTaskManagerMetricsInfo(tmMetrics);
			} else {
				log.debug("No metrics for TaskManager {}.", taskManagerResourceId);
				taskManagerMetricsInfo = TaskManagerMetricsInfo.empty();
			}

			return new TaskManagerDetailsInfo(
				taskManagerInfo,
				taskManagerMetricsInfo);
		})
		.exceptionally(
			(Throwable throwable) -> {
				final Throwable strippedThrowable = ExceptionUtils.stripExecutionException(throwable);

				if (strippedThrowable instanceof UnknownTaskExecutorException) {
					throw new CompletionException(
						new RestHandlerException(
							"Could not find TaskExecutor " + taskManagerResourceId + '.',
							HttpResponseStatus.NOT_FOUND,
							strippedThrowable));
				} else {
					throw new CompletionException(strippedThrowable);
				}
			}
		);
}