org.apache.flink.runtime.rest.messages.taskmanager.TaskManagerDetailsInfo Java Examples

The following examples show how to use org.apache.flink.runtime.rest.messages.taskmanager.TaskManagerDetailsInfo. 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: TaskManagerDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public TaskManagerDetailsHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> responseHeaders,
		MessageHeaders<EmptyRequestBody, TaskManagerDetailsInfo, TaskManagerMessageParameters> messageHeaders,
		GatewayRetriever<ResourceManagerGateway> resourceManagerGatewayRetriever,
		MetricFetcher metricFetcher) {
	super(leaderRetriever, timeout, responseHeaders, messageHeaders, resourceManagerGatewayRetriever);

	this.metricFetcher = Preconditions.checkNotNull(metricFetcher);
	this.metricStore = metricFetcher.getMetricStore();
}
 
Example #2
Source File: TaskManagerDetailsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
public TaskManagerDetailsHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> responseHeaders,
		MessageHeaders<EmptyRequestBody, TaskManagerDetailsInfo, TaskManagerMessageParameters> messageHeaders,
		GatewayRetriever<ResourceManagerGateway> resourceManagerGatewayRetriever,
		MetricFetcher metricFetcher) {
	super(leaderRetriever, timeout, responseHeaders, messageHeaders, resourceManagerGatewayRetriever);

	this.metricFetcher = Preconditions.checkNotNull(metricFetcher);
	this.metricStore = metricFetcher.getMetricStore();
}
 
Example #3
Source File: TaskManagerDetailsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
public TaskManagerDetailsHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> responseHeaders,
		MessageHeaders<EmptyRequestBody, TaskManagerDetailsInfo, TaskManagerMessageParameters> messageHeaders,
		GatewayRetriever<ResourceManagerGateway> resourceManagerGatewayRetriever,
		MetricFetcher metricFetcher) {
	super(leaderRetriever, timeout, responseHeaders, messageHeaders, resourceManagerGatewayRetriever);

	this.metricFetcher = Preconditions.checkNotNull(metricFetcher);
	this.metricStore = metricFetcher.getMetricStore();
}
 
Example #4
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 #5
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 #6
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);
				}
			}
		);
}