org.apache.flink.runtime.rest.NotFoundException Java Examples

The following examples show how to use org.apache.flink.runtime.rest.NotFoundException. 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: AbstractExecutionGraphHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<R> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, M> request, @Nonnull RestfulGateway gateway) throws RestHandlerException {
	JobID jobId = request.getPathParameter(JobIDPathParameter.class);

	CompletableFuture<AccessExecutionGraph> executionGraphFuture = executionGraphCache.getExecutionGraph(jobId, gateway);

	return executionGraphFuture.thenApplyAsync(
		executionGraph -> {
			try {
				return handleRequest(request, executionGraph);
			} catch (RestHandlerException rhe) {
				throw new CompletionException(rhe);
			}
		}, executor)
		.exceptionally(throwable -> {
			throwable = ExceptionUtils.stripCompletionException(throwable);
			if (throwable instanceof FlinkJobNotFoundException) {
				throw new CompletionException(
					new NotFoundException(String.format("Job %s not found", jobId), throwable));
			} else {
				throw new CompletionException(throwable);
			}
		});
}
 
Example #2
Source File: AbstractAsynchronousOperationHandlers.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<AsynchronousOperationResult<V>> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, M> request, @Nonnull T gateway) throws RestHandlerException {

	final K key = getOperationKey(request);

	final Either<Throwable, R> operationResultOrError;
	try {
		operationResultOrError = completedOperationCache.get(key);
	} catch (UnknownOperationKeyException e) {
		return FutureUtils.completedExceptionally(
			new NotFoundException("Operation not found under key: " + key, e));
	}

	if (operationResultOrError != null) {
		if (operationResultOrError.isLeft()) {
			return CompletableFuture.completedFuture(
				AsynchronousOperationResult.completed(exceptionalOperationResultResponse(operationResultOrError.left())));
		} else {
			return CompletableFuture.completedFuture(
				AsynchronousOperationResult.completed(operationResultResponse(operationResultOrError.right())));
		}
	} else {
		return CompletableFuture.completedFuture(AsynchronousOperationResult.inProgress());
	}
}
 
Example #3
Source File: AbstractExecutionGraphHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<R> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, M> request, @Nonnull RestfulGateway gateway) throws RestHandlerException {
	JobID jobId = request.getPathParameter(JobIDPathParameter.class);

	CompletableFuture<AccessExecutionGraph> executionGraphFuture = executionGraphCache.getExecutionGraph(jobId, gateway);

	return executionGraphFuture.thenApplyAsync(
		executionGraph -> {
			try {
				return handleRequest(request, executionGraph);
			} catch (RestHandlerException rhe) {
				throw new CompletionException(rhe);
			}
		}, executor)
		.exceptionally(throwable -> {
			throwable = ExceptionUtils.stripCompletionException(throwable);
			if (throwable instanceof FlinkJobNotFoundException) {
				throw new CompletionException(
					new NotFoundException(String.format("Job %s not found", jobId), throwable));
			} else {
				throw new CompletionException(throwable);
			}
		});
}
 
Example #4
Source File: AbstractAsynchronousOperationHandlers.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<AsynchronousOperationResult<V>> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, M> request, @Nonnull T gateway) throws RestHandlerException {

	final K key = getOperationKey(request);

	final Either<Throwable, R> operationResultOrError;
	try {
		operationResultOrError = completedOperationCache.get(key);
	} catch (UnknownOperationKeyException e) {
		return FutureUtils.completedExceptionally(
			new NotFoundException("Operation not found under key: " + key, e));
	}

	if (operationResultOrError != null) {
		if (operationResultOrError.isLeft()) {
			return CompletableFuture.completedFuture(
				AsynchronousOperationResult.completed(exceptionalOperationResultResponse(operationResultOrError.left())));
		} else {
			return CompletableFuture.completedFuture(
				AsynchronousOperationResult.completed(operationResultResponse(operationResultOrError.right())));
		}
	} else {
		return CompletableFuture.completedFuture(AsynchronousOperationResult.inProgress());
	}
}
 
Example #5
Source File: AbstractExecutionGraphHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<R> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, M> request, @Nonnull RestfulGateway gateway) throws RestHandlerException {
	JobID jobId = request.getPathParameter(JobIDPathParameter.class);

	CompletableFuture<AccessExecutionGraph> executionGraphFuture = executionGraphCache.getExecutionGraph(jobId, gateway);

	return executionGraphFuture.thenApplyAsync(
		executionGraph -> {
			try {
				return handleRequest(request, executionGraph);
			} catch (RestHandlerException rhe) {
				throw new CompletionException(rhe);
			}
		}, executor)
		.exceptionally(throwable -> {
			throwable = ExceptionUtils.stripCompletionException(throwable);
			if (throwable instanceof FlinkJobNotFoundException) {
				throw new CompletionException(
					new NotFoundException(String.format("Job %s not found", jobId), throwable));
			} else {
				throw new CompletionException(throwable);
			}
		});
}
 
Example #6
Source File: AbstractAsynchronousOperationHandlers.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<AsynchronousOperationResult<V>> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, M> request, @Nonnull T gateway) throws RestHandlerException {

	final K key = getOperationKey(request);

	final Either<Throwable, R> operationResultOrError;
	try {
		operationResultOrError = completedOperationCache.get(key);
	} catch (UnknownOperationKeyException e) {
		return FutureUtils.completedExceptionally(
			new NotFoundException("Operation not found under key: " + key, e));
	}

	if (operationResultOrError != null) {
		if (operationResultOrError.isLeft()) {
			return CompletableFuture.completedFuture(
				AsynchronousOperationResult.completed(exceptionalOperationResultResponse(operationResultOrError.left())));
		} else {
			return CompletableFuture.completedFuture(
				AsynchronousOperationResult.completed(operationResultResponse(operationResultOrError.right())));
		}
	} else {
		return CompletableFuture.completedFuture(AsynchronousOperationResult.inProgress());
	}
}
 
Example #7
Source File: TaskCheckpointStatisticDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected TaskCheckpointStatisticsWithSubtaskDetails handleCheckpointRequest(
		HandlerRequest<EmptyRequestBody, TaskCheckpointMessageParameters> request,
		AbstractCheckpointStats checkpointStats) throws RestHandlerException {

	final JobVertexID jobVertexId = request.getPathParameter(JobVertexIdPathParameter.class);

	final TaskStateStats taskStatistics = checkpointStats.getTaskStateStats(jobVertexId);

	if (taskStatistics == null) {
		throw new NotFoundException("There is no checkpoint statistics for task " + jobVertexId + '.');
	}

	return createCheckpointDetails(checkpointStats, taskStatistics);
}
 
Example #8
Source File: JobVertexTaskManagersHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected JobVertexTaskManagersInfo handleRequest(
		HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request,
		AccessExecutionGraph executionGraph) throws RestHandlerException {
	JobID jobID = request.getPathParameter(JobIDPathParameter.class);
	JobVertexID jobVertexID = request.getPathParameter(JobVertexIdPathParameter.class);
	AccessExecutionJobVertex jobVertex = executionGraph.getJobVertex(jobVertexID);

	if (jobVertex == null) {
		throw new NotFoundException(String.format("JobVertex %s not found", jobVertexID));
	}

	return createJobVertexTaskManagersInfo(jobVertex, jobID, metricFetcher);
}
 
Example #9
Source File: JobVertexDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected JobVertexDetailsInfo handleRequest(
		HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request,
		AccessExecutionGraph executionGraph) throws NotFoundException {
	JobID jobID = request.getPathParameter(JobIDPathParameter.class);
	JobVertexID jobVertexID = request.getPathParameter(JobVertexIdPathParameter.class);
	AccessExecutionJobVertex jobVertex = executionGraph.getJobVertex(jobVertexID);

	if (jobVertex == null) {
		throw new NotFoundException(String.format("JobVertex %s not found", jobVertexID));
	}

	return createJobVertexDetailsInfo(jobVertex, jobID, metricFetcher);
}
 
Example #10
Source File: TaskCheckpointStatisticDetailsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected TaskCheckpointStatisticsWithSubtaskDetails handleCheckpointRequest(
		HandlerRequest<EmptyRequestBody, TaskCheckpointMessageParameters> request,
		AbstractCheckpointStats checkpointStats) throws RestHandlerException {

	final JobVertexID jobVertexId = request.getPathParameter(JobVertexIdPathParameter.class);

	final TaskStateStats taskStatistics = checkpointStats.getTaskStateStats(jobVertexId);

	if (taskStatistics == null) {
		throw new NotFoundException("There is no checkpoint statistics for task " + jobVertexId + '.');
	}

	return createCheckpointDetails(checkpointStats, taskStatistics);
}
 
Example #11
Source File: JobVertexTaskManagersHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected JobVertexTaskManagersInfo handleRequest(
		HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request,
		AccessExecutionGraph executionGraph) throws RestHandlerException {
	JobID jobID = request.getPathParameter(JobIDPathParameter.class);
	JobVertexID jobVertexID = request.getPathParameter(JobVertexIdPathParameter.class);
	AccessExecutionJobVertex jobVertex = executionGraph.getJobVertex(jobVertexID);

	if (jobVertex == null) {
		throw new NotFoundException(String.format("JobVertex %s not found", jobVertexID));
	}

	return createJobVertexTaskManagersInfo(jobVertex, jobID, metricFetcher);
}
 
Example #12
Source File: JobVertexDetailsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected JobVertexDetailsInfo handleRequest(
		HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request,
		AccessExecutionGraph executionGraph) throws NotFoundException {
	JobID jobID = request.getPathParameter(JobIDPathParameter.class);
	JobVertexID jobVertexID = request.getPathParameter(JobVertexIdPathParameter.class);
	AccessExecutionJobVertex jobVertex = executionGraph.getJobVertex(jobVertexID);

	if (jobVertex == null) {
		throw new NotFoundException(String.format("JobVertex %s not found", jobVertexID));
	}

	return createJobVertexDetailsInfo(jobVertex, jobID, metricFetcher);
}
 
Example #13
Source File: TaskCheckpointStatisticDetailsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected TaskCheckpointStatisticsWithSubtaskDetails handleCheckpointRequest(
		HandlerRequest<EmptyRequestBody, TaskCheckpointMessageParameters> request,
		AbstractCheckpointStats checkpointStats) throws RestHandlerException {

	final JobVertexID jobVertexId = request.getPathParameter(JobVertexIdPathParameter.class);

	final TaskStateStats taskStatistics = checkpointStats.getTaskStateStats(jobVertexId);

	if (taskStatistics == null) {
		throw new NotFoundException("There is no checkpoint statistics for task " + jobVertexId + '.');
	}

	return createCheckpointDetails(checkpointStats, taskStatistics);
}
 
Example #14
Source File: JobVertexTaskManagersHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected JobVertexTaskManagersInfo handleRequest(
		HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request,
		AccessExecutionGraph executionGraph) throws RestHandlerException {
	JobID jobID = request.getPathParameter(JobIDPathParameter.class);
	JobVertexID jobVertexID = request.getPathParameter(JobVertexIdPathParameter.class);
	AccessExecutionJobVertex jobVertex = executionGraph.getJobVertex(jobVertexID);

	if (jobVertex == null) {
		throw new NotFoundException(String.format("JobVertex %s not found", jobVertexID));
	}

	return createJobVertexTaskManagersInfo(jobVertex, jobID, metricFetcher);
}
 
Example #15
Source File: JobVertexDetailsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected JobVertexDetailsInfo handleRequest(
		HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request,
		AccessExecutionGraph executionGraph) throws NotFoundException {
	JobID jobID = request.getPathParameter(JobIDPathParameter.class);
	JobVertexID jobVertexID = request.getPathParameter(JobVertexIdPathParameter.class);
	AccessExecutionJobVertex jobVertex = executionGraph.getJobVertex(jobVertexID);

	if (jobVertex == null) {
		throw new NotFoundException(String.format("JobVertex %s not found", jobVertexID));
	}

	return createJobVertexDetailsInfo(jobVertex, jobID, metricFetcher);
}