use of org.apache.flink.runtime.resourcemanager.exceptions.UnknownTaskExecutorException in project flink by apache.
the class TaskManagerLogListHandler method handleRequest.
@Override
protected CompletableFuture<LogListInfo> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody> 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);
}
});
}
Aggregations