Java Code Examples for org.apache.flink.runtime.rest.messages.taskmanager.TaskManagersHeaders

The following examples show how to use org.apache.flink.runtime.rest.messages.taskmanager.TaskManagersHeaders. These examples are extracted from open source projects. 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 Project: Flink-CEPplus   Source File: MetricsAvailabilityITCase.java    License: 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 2
Source Project: flink   Source File: MetricsAvailabilityITCase.java    License: 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 3
Source Project: flink   Source File: MetricsAvailabilityITCase.java    License: 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
private static int getNumberOfSlotsPerTaskManager(final String host, final int port) throws Exception {
	final TaskManagersInfo taskManagersInfo = restClient.sendRequest(
		host,
		port,
		TaskManagersHeaders.getInstance()).get();

	return taskManagersInfo.getTaskManagerInfos()
		.stream()
		.map(TaskManagerInfo::getNumberSlots)
		.findFirst()
		.orElse(0);
}
 
Example 5
Source Project: flink   Source File: YARNSessionCapacitySchedulerITCase.java    License: Apache License 2.0 5 votes vote down vote up
private static int getNumberOfSlotsPerTaskManager(final String host, final int port) throws Exception {
	final TaskManagersInfo taskManagersInfo = restClient.sendRequest(
		host,
		port,
		TaskManagersHeaders.getInstance()).get();

	return taskManagersInfo.getTaskManagerInfos()
		.stream()
		.map(TaskManagerInfo::getNumberSlots)
		.findFirst()
		.orElse(0);
}
 
Example 6
Source Project: flink   Source File: YARNSessionCapacitySchedulerITCase.java    License: Apache License 2.0 5 votes vote down vote up
private static int getNumberOfSlotsPerTaskManager(final String host, final int port) throws Exception {
	final TaskManagersInfo taskManagersInfo = restClient.sendRequest(
		host,
		port,
		TaskManagersHeaders.getInstance()).get();

	return taskManagersInfo.getTaskManagerInfos()
		.stream()
		.map(TaskManagerInfo::getNumberSlots)
		.findFirst()
		.orElse(0);
}