org.apache.flink.runtime.rest.messages.EmptyRequestBody Java Examples

The following examples show how to use org.apache.flink.runtime.rest.messages.EmptyRequestBody. 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: AbstractTaskManagerFileHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
protected AbstractTaskManagerFileHandler(
		@Nonnull GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		@Nonnull Time timeout,
		@Nonnull Map<String, String> responseHeaders,
		@Nonnull UntypedResponseMessageHeaders<EmptyRequestBody, M> untypedResponseMessageHeaders,
		@Nonnull GatewayRetriever<ResourceManagerGateway> resourceManagerGatewayRetriever,
		@Nonnull TransientBlobService transientBlobService,
		@Nonnull Time cacheEntryDuration) {
	super(leaderRetriever, timeout, responseHeaders, untypedResponseMessageHeaders);

	this.resourceManagerGatewayRetriever = Preconditions.checkNotNull(resourceManagerGatewayRetriever);

	this.transientBlobService = Preconditions.checkNotNull(transientBlobService);

	this.fileBlobKeys = CacheBuilder
		.newBuilder()
		.expireAfterWrite(cacheEntryDuration.toMilliseconds(), TimeUnit.MILLISECONDS)
		.removalListener(this::removeBlob)
		.build(
			new CacheLoader<ResourceID, CompletableFuture<TransientBlobKey>>() {
				@Override
				public CompletableFuture<TransientBlobKey> load(ResourceID resourceId) throws Exception {
					return loadTaskManagerFile(resourceId);
				}
		});
}
 
Example #2
Source File: JobIdsHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<JobIdsWithStatusOverview> handleRequest(
		@Nonnull HandlerRequest<EmptyRequestBody, EmptyMessageParameters> request,
		@Nonnull RestfulGateway gateway) throws RestHandlerException {

	return gateway.requestMultipleJobDetails(timeout).thenApply(
		multipleJobDetails -> new JobIdsWithStatusOverview(
			multipleJobDetails
				.getJobs()
				.stream()
				.map(
					jobDetails ->
						new JobIdsWithStatusOverview.JobIdWithStatus(
							jobDetails.getJobId(),
							jobDetails.getStatus()))
				.collect(Collectors.toList())
		)
	);
}
 
Example #3
Source File: MetricsAvailabilityITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private static Collection<ResourceID> getTaskManagerIds(final RestClient restClient) throws Exception {
	final TaskManagersHeaders headers = TaskManagersHeaders.getInstance();

	final TaskManagersInfo response = fetchMetric(() ->
			restClient.sendRequest(
				HOST,
				PORT,
				headers,
				EmptyMessageParameters.getInstance(),
				EmptyRequestBody.getInstance()),
		taskManagersInfo -> !taskManagersInfo.getTaskManagerInfos().isEmpty());

	return response.getTaskManagerInfos().stream()
		.map(TaskManagerInfo::getResourceId)
		.collect(Collectors.toList());
}
 
Example #4
Source File: JobDetailsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
public JobDetailsHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> responseHeaders,
		MessageHeaders<EmptyRequestBody, JobDetailsInfo, JobMessageParameters> messageHeaders,
		ExecutionGraphCache executionGraphCache,
		Executor executor,
		MetricFetcher metricFetcher) {
	super(
		leaderRetriever,
		timeout,
		responseHeaders,
		messageHeaders,
		executionGraphCache,
		executor);

	this.metricFetcher = Preconditions.checkNotNull(metricFetcher);
}
 
Example #5
Source File: RestClientMultipartTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testFileMultipart() throws Exception {
	Collection<FileUpload> files = MULTIPART_UPLOAD_RESOURCE.getFilesToUpload().stream()
		.map(file -> new FileUpload(file.toPath(), "application/octet-stream")).collect(Collectors.toList());

	CompletableFuture<EmptyResponseBody> responseFuture = restClient.sendRequest(
		MULTIPART_UPLOAD_RESOURCE.getServerSocketAddress().getHostName(),
		MULTIPART_UPLOAD_RESOURCE.getServerSocketAddress().getPort(),
		MULTIPART_UPLOAD_RESOURCE.getFileHandler().getMessageHeaders(),
		EmptyMessageParameters.getInstance(),
		EmptyRequestBody.getInstance(),
		files
	);

	responseFuture.get();
}
 
Example #6
Source File: AggregatingSubtasksMetricsHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
Collection<? extends MetricStore.ComponentMetricStore> getStores(MetricStore store, HandlerRequest<EmptyRequestBody, AggregatedSubtaskMetricsParameters> request) {
	JobID jobID = request.getPathParameter(JobIDPathParameter.class);
	JobVertexID taskID = request.getPathParameter(JobVertexIdPathParameter.class);

	Collection<String> subtaskRanges = request.getQueryParameter(SubtasksFilterQueryParameter.class);
	if (subtaskRanges.isEmpty()) {
		MetricStore.TaskMetricStore taskMetricStore = store.getTaskMetricStore(jobID.toString(), taskID.toString());
		if (taskMetricStore != null) {
			return taskMetricStore.getAllSubtaskMetricStores();
		} else {
			return Collections.emptyList();
		}
	} else {
		Iterable<Integer> subtasks = getIntegerRangeFromString(subtaskRanges);
		Collection<MetricStore.ComponentMetricStore> subtaskStores = new ArrayList<>(8);
		for (int subtask : subtasks) {
			MetricStore.ComponentMetricStore subtaskMetricStore = store.getSubtaskMetricStore(jobID.toString(), taskID.toString(), subtask);
			if (subtaskMetricStore != null) {
				subtaskStores.add(subtaskMetricStore);
			}
		}
		return subtaskStores;
	}
}
 
Example #7
Source File: AbstractMetricsHandlerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetMetrics() throws Exception {
	final CompletableFuture<MetricCollectionResponseBody> completableFuture =
		testMetricsHandler.handleRequest(
			new HandlerRequest<>(
				EmptyRequestBody.getInstance(),
				new TestMessageParameters(),
				Collections.emptyMap(),
				Collections.singletonMap(METRICS_FILTER_QUERY_PARAM, Collections.singletonList(TEST_METRIC_NAME))),
			mockDispatcherGateway);

	assertTrue(completableFuture.isDone());

	final MetricCollectionResponseBody metricCollectionResponseBody = completableFuture.get();
	assertThat(metricCollectionResponseBody.getMetrics(), hasSize(1));

	final Metric metric = metricCollectionResponseBody.getMetrics().iterator().next();
	assertThat(metric.getId(), equalTo(TEST_METRIC_NAME));
	assertThat(metric.getValue(), equalTo(Integer.toString(TEST_METRIC_VALUE)));
}
 
Example #8
Source File: JobPlanHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public JobPlanHandler(
	GatewayRetriever<? extends RestfulGateway> leaderRetriever,
	Time timeout,
	Map<String, String> headers,
	MessageHeaders<EmptyRequestBody, JobPlanInfo, JobMessageParameters> messageHeaders,
	ExecutionGraphCache executionGraphCache,
	Executor executor) {

	super(
		leaderRetriever,
		timeout,
		headers,
		messageHeaders,
		executionGraphCache,
		executor);
}
 
Example #9
Source File: JobExecutionResultHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<JobExecutionResultResponseBody> handleRequest(
		@Nonnull final HandlerRequest<EmptyRequestBody, JobMessageParameters> request,
		@Nonnull final RestfulGateway gateway) throws RestHandlerException {

	final JobID jobId = request.getPathParameter(JobIDPathParameter.class);

	final CompletableFuture<JobStatus> jobStatusFuture = gateway.requestJobStatus(jobId, timeout);

	return jobStatusFuture.thenCompose(
		jobStatus -> {
			if (jobStatus.isGloballyTerminalState()) {
				return gateway
					.requestJobResult(jobId, timeout)
					.thenApply(JobExecutionResultResponseBody::created);
			} else {
				return CompletableFuture.completedFuture(
					JobExecutionResultResponseBody.inProgress());
			}
		}).exceptionally(throwable -> {
			throw propagateException(throwable);
		});
}
 
Example #10
Source File: JarDeleteHandlerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testFailedDelete() throws Exception {
	makeJarDirReadOnly();

	final HandlerRequest<EmptyRequestBody, JarDeleteMessageParameters> request = createRequest(TEST_JAR_NAME);
	try {
		jarDeleteHandler.handleRequest(request, restfulGateway).get();
	} catch (final ExecutionException e) {
		final Throwable throwable = ExceptionUtils.stripCompletionException(e.getCause());
		assertThat(throwable, instanceOf(RestHandlerException.class));

		final RestHandlerException restHandlerException = (RestHandlerException) throwable;
		assertThat(restHandlerException.getMessage(), containsString("Failed to delete jar"));
		assertThat(restHandlerException.getHttpResponseStatus(), equalTo(HttpResponseStatus.INTERNAL_SERVER_ERROR));
	}
}
 
Example #11
Source File: JobVertexBackPressureHandlerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testAbsentBackPressure() throws Exception {
	final Map<String, String> pathParameters = new HashMap<>();
	pathParameters.put(JobIDPathParameter.KEY, TEST_JOB_ID_BACK_PRESSURE_STATS_ABSENT.toString());
	pathParameters.put(JobVertexIdPathParameter.KEY, new JobVertexID().toString());

	final HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request =
		new HandlerRequest<>(
			EmptyRequestBody.getInstance(),
			new JobVertexMessageParameters(), pathParameters, Collections.emptyMap());

	final CompletableFuture<JobVertexBackPressureInfo> jobVertexBackPressureInfoCompletableFuture =
		jobVertexBackPressureHandler.handleRequest(request, restfulGateway);
	final JobVertexBackPressureInfo jobVertexBackPressureInfo = jobVertexBackPressureInfoCompletableFuture.get();

	assertThat(jobVertexBackPressureInfo.getStatus(), equalTo(VertexBackPressureStatus.DEPRECATED));
}
 
Example #12
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 #13
Source File: JobVertexDetailsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
public JobVertexDetailsHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> responseHeaders,
		MessageHeaders<EmptyRequestBody, JobVertexDetailsInfo, JobVertexMessageParameters> messageHeaders,
		ExecutionGraphCache executionGraphCache,
		Executor executor,
		MetricFetcher metricFetcher) {
	super(
		leaderRetriever,
		timeout,
		responseHeaders,
		messageHeaders,
		executionGraphCache,
		executor);
	this.metricFetcher = metricFetcher;
}
 
Example #14
Source File: JobExceptionsHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public JobExceptionsHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> responseHeaders,
		MessageHeaders<EmptyRequestBody, JobExceptionsInfo, JobMessageParameters> messageHeaders,
		ExecutionGraphCache executionGraphCache,
		Executor executor) {

	super(
		leaderRetriever,
		timeout,
		responseHeaders,
		messageHeaders,
		executionGraphCache,
		executor);
}
 
Example #15
Source File: JobVertexAccumulatorsHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
protected JobVertexAccumulatorsInfo handleRequest(
		HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request,
		AccessExecutionJobVertex jobVertex) throws RestHandlerException {

	StringifiedAccumulatorResult[] accs = jobVertex.getAggregatedUserAccumulatorsStringified();
	ArrayList<UserAccumulator> userAccumulatorList = new ArrayList<>(accs.length);

	for (StringifiedAccumulatorResult acc : accs) {
		userAccumulatorList.add(
			new UserAccumulator(
				acc.getName(),
				acc.getType(),
				acc.getValue()));
	}

	return new JobVertexAccumulatorsInfo(jobVertex.getJobVertexId().toString(), userAccumulatorList);
}
 
Example #16
Source File: RestServerEndpointITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testVersioning() throws Exception {
	CompletableFuture<EmptyResponseBody> unspecifiedVersionResponse = restClient.sendRequest(
		serverAddress.getHostName(),
		serverAddress.getPort(),
		TestVersionHeaders.INSTANCE,
		EmptyMessageParameters.getInstance(),
		EmptyRequestBody.getInstance(),
		Collections.emptyList()
	);

	unspecifiedVersionResponse.get(5, TimeUnit.SECONDS);

	CompletableFuture<EmptyResponseBody> specifiedVersionResponse = restClient.sendRequest(
		serverAddress.getHostName(),
		serverAddress.getPort(),
		TestVersionHeaders.INSTANCE,
		EmptyMessageParameters.getInstance(),
		EmptyRequestBody.getInstance(),
		Collections.emptyList(),
		RestAPIVersion.V1
	);

	specifiedVersionResponse.get(5, TimeUnit.SECONDS);
}
 
Example #17
Source File: JobTerminationHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public JobTerminationHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> headers,
		MessageHeaders<EmptyRequestBody, EmptyResponseBody, JobTerminationMessageParameters> messageHeaders,
		TerminationModeQueryParameter.TerminationMode defaultTerminationMode) {
	super(leaderRetriever, timeout, headers, messageHeaders);

	this.defaultTerminationMode = Preconditions.checkNotNull(defaultTerminationMode);
}
 
Example #18
Source File: RestClusterClientTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected CompletableFuture<EmptyResponseBody> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, EmptyMessageParameters> request, @Nonnull DispatcherGateway gateway) throws RestHandlerException {
	final CompletableFuture<EmptyResponseBody> result = responseQueue.poll();

	if (result != null) {
		return result;
	} else {
		return CompletableFuture.completedFuture(EmptyResponseBody.getInstance());
	}
}
 
Example #19
Source File: JarSubmissionITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static JarListInfo listJars(JarListHandler handler, RestfulGateway restfulGateway) throws Exception {
	HandlerRequest<EmptyRequestBody, EmptyMessageParameters> listRequest = new HandlerRequest<>(
		EmptyRequestBody.getInstance(),
		EmptyMessageParameters.getInstance());
	return handler.handleRequest(listRequest, restfulGateway)
		.get();
}
 
Example #20
Source File: SubtaskExecutionAttemptAccumulatorsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new Abstract job vertex handler.
 *
 * @param leaderRetriever     the leader retriever
 * @param timeout             the timeout
 * @param responseHeaders     the response headers
 * @param messageHeaders      the message headers
 * @param executionGraphCache the execution graph cache
 * @param executor            the executor
 */
public SubtaskExecutionAttemptAccumulatorsHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> responseHeaders,
		MessageHeaders<EmptyRequestBody, SubtaskExecutionAttemptAccumulatorsInfo, SubtaskAttemptMessageParameters> messageHeaders,
		ExecutionGraphCache executionGraphCache,
		Executor executor) {

	super(leaderRetriever, timeout, responseHeaders, messageHeaders, executionGraphCache, executor);
}
 
Example #21
Source File: JarUploadHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected CompletableFuture<JarUploadResponseBody> handleRequest(
		@Nonnull final HandlerRequest<EmptyRequestBody, EmptyMessageParameters> request,
		@Nonnull final RestfulGateway gateway) throws RestHandlerException {
	Collection<File> uploadedFiles = request.getUploadedFiles();
	if (uploadedFiles.size() != 1) {
		throw new RestHandlerException("Exactly 1 file must be sent, received " + uploadedFiles.size() + '.', HttpResponseStatus.BAD_REQUEST);
	}
	final Path fileUpload = uploadedFiles.iterator().next().toPath();
	return CompletableFuture.supplyAsync(() -> {
		if (!fileUpload.getFileName().toString().endsWith(".jar")) {
			throw new CompletionException(new RestHandlerException(
				"Only Jar files are allowed.",
				HttpResponseStatus.BAD_REQUEST));
		} else {
			final Path destination = jarDir.resolve(UUID.randomUUID() + "_" + fileUpload.getFileName());
			try {
				Files.move(fileUpload, destination);
			} catch (IOException e) {
				throw new CompletionException(new RestHandlerException(
					String.format("Could not move uploaded jar file [%s] to [%s].",
						fileUpload,
						destination),
					HttpResponseStatus.INTERNAL_SERVER_ERROR,
					e));
			}
			return new JarUploadResponseBody(destination
				.normalize()
				.toString());
		}
	}, executor);
}
 
Example #22
Source File: JobCancellationHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
public JobCancellationHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> headers,
		MessageHeaders<EmptyRequestBody, EmptyResponseBody, JobCancellationMessageParameters> messageHeaders,
		TerminationModeQueryParameter.TerminationMode defaultTerminationMode) {
	super(leaderRetriever, timeout, headers, messageHeaders);

	this.defaultTerminationMode = Preconditions.checkNotNull(defaultTerminationMode);
}
 
Example #23
Source File: AbstractMetricsHandlerTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected MetricStore.ComponentMetricStore getComponentMetricStore(
	HandlerRequest<EmptyRequestBody,
		TestMessageParameters> request,
	MetricStore metricStore) {
	return returnComponentMetricStore ? metricStore.getJobManager() : null;
}
 
Example #24
Source File: JobExecutionResultHandlerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	final TestingRestfulGateway testingRestfulGateway = TestingRestfulGateway.newBuilder().build();

	jobExecutionResultHandler = new JobExecutionResultHandler(
		() -> CompletableFuture.completedFuture(testingRestfulGateway),
		Time.seconds(10),
		Collections.emptyMap());

	testRequest = new HandlerRequest<>(
		EmptyRequestBody.getInstance(),
		new JobMessageParameters(),
		Collections.singletonMap("jobid", TEST_JOB_ID.toString()),
		Collections.emptyMap());
}
 
Example #25
Source File: JobAccumulatorsHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public JobAccumulatorsHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> responseHeaders,
		MessageHeaders<EmptyRequestBody, JobAccumulatorsInfo, JobAccumulatorsMessageParameters> messageHeaders,
		ExecutionGraphCache executionGraphCache,
		Executor executor) {
	super(
		leaderRetriever,
		timeout,
		responseHeaders,
		messageHeaders,
		executionGraphCache,
		executor);
}
 
Example #26
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 #27
Source File: AggregatingMetricsHandlerTestBase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testAvgAggregation() throws Exception {
	Map<String, List<String>> queryParams = new HashMap<>(4);
	queryParams.put("get", Collections.singletonList("abc.metric1"));
	queryParams.put("agg", Collections.singletonList("avg"));

	HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>(
		EmptyRequestBody.getInstance(),
		handler.getMessageHeaders().getUnresolvedMessageParameters(),
		pathParameters,
		queryParams
	);

	AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY)
		.get();

	Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics();

	assertEquals(1, aggregatedMetrics.size());
	AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next();

	assertEquals("abc.metric1", aggregatedMetric.getId());
	assertEquals(2.0, aggregatedMetric.getAvg(), 0.1);
	assertNull(aggregatedMetric.getMin());
	assertNull(aggregatedMetric.getMax());
	assertNull(aggregatedMetric.getSum());
}
 
Example #28
Source File: AbstractMetricsHandlerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected MetricStore.ComponentMetricStore getComponentMetricStore(
	HandlerRequest<EmptyRequestBody,
		TestMessageParameters> request,
	MetricStore metricStore) {
	return returnComponentMetricStore ? metricStore.getJobManager() : null;
}
 
Example #29
Source File: ClusterOverviewHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<ClusterOverviewWithVersion> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, EmptyMessageParameters> request, @Nonnull RestfulGateway gateway) {
	CompletableFuture<ClusterOverview> overviewFuture = gateway.requestClusterOverview(timeout);

	return overviewFuture.thenApply(
		statusOverview -> ClusterOverviewWithVersion.fromStatusOverview(statusOverview, version, commitID));
}
 
Example #30
Source File: JobAccumulatorsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected JobAccumulatorsInfo handleRequest(HandlerRequest<EmptyRequestBody, JobAccumulatorsMessageParameters> request, AccessExecutionGraph graph) throws RestHandlerException {
	List<Boolean> queryParams = request.getQueryParameter(AccumulatorsIncludeSerializedValueQueryParameter.class);

	final boolean includeSerializedValue;
	if (!queryParams.isEmpty()) {
		includeSerializedValue = queryParams.get(0);
	} else {
		includeSerializedValue = false;
	}

	return createJobAccumulatorsInfo(graph, includeSerializedValue);
}