Java Code Examples for org.apache.flink.runtime.rest.messages.JobVertexBackPressureHeaders

The following examples show how to use org.apache.flink.runtime.rest.messages.JobVertexBackPressureHeaders. 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
@Before
public void setUp() {
	restfulGateway = TestingRestfulGateway.newBuilder().setRequestOperatorBackPressureStatsFunction(
		(jobId, jobVertexId) -> {
			if (jobId.equals(TEST_JOB_ID_BACK_PRESSURE_STATS_AVAILABLE)) {
				return CompletableFuture.completedFuture(OperatorBackPressureStatsResponse.of(new OperatorBackPressureStats(
					4711,
					Integer.MAX_VALUE,
					new double[]{1.0, 0.5, 0.1}
				)));
			} else if (jobId.equals(TEST_JOB_ID_BACK_PRESSURE_STATS_ABSENT)) {
				return CompletableFuture.completedFuture(OperatorBackPressureStatsResponse.of(null));
			} else {
				throw new AssertionError();
			}
		}
	).build();
	jobVertexBackPressureHandler = new JobVertexBackPressureHandler(
		() -> CompletableFuture.completedFuture(restfulGateway),
		Time.seconds(10),
		Collections.emptyMap(),
		JobVertexBackPressureHeaders.getInstance()
	);
}
 
Example 2
Source Project: flink   Source File: JobVertexBackPressureHandlerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
	restfulGateway = TestingRestfulGateway.newBuilder().setRequestOperatorBackPressureStatsFunction(
		(jobId, jobVertexId) -> {
			if (jobId.equals(TEST_JOB_ID_BACK_PRESSURE_STATS_AVAILABLE)) {
				return CompletableFuture.completedFuture(OperatorBackPressureStatsResponse.of(new OperatorBackPressureStats(
					4711,
					Integer.MAX_VALUE,
					new double[]{1.0, 0.5, 0.1}
				)));
			} else if (jobId.equals(TEST_JOB_ID_BACK_PRESSURE_STATS_ABSENT)) {
				return CompletableFuture.completedFuture(OperatorBackPressureStatsResponse.of(null));
			} else {
				throw new AssertionError();
			}
		}
	).build();
	jobVertexBackPressureHandler = new JobVertexBackPressureHandler(
		() -> CompletableFuture.completedFuture(restfulGateway),
		Time.seconds(10),
		Collections.emptyMap(),
		JobVertexBackPressureHeaders.getInstance()
	);
}
 
Example 3
Source Project: flink   Source File: JobVertexBackPressureHandlerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
	restfulGateway = new TestingRestfulGateway.Builder().setRequestOperatorBackPressureStatsFunction(
		(jobId, jobVertexId) -> {
			if (jobId.equals(TEST_JOB_ID_BACK_PRESSURE_STATS_AVAILABLE)) {
				return CompletableFuture.completedFuture(OperatorBackPressureStatsResponse.of(new OperatorBackPressureStats(
					4711,
					Integer.MAX_VALUE,
					new double[]{1.0, 0.5, 0.1}
				)));
			} else if (jobId.equals(TEST_JOB_ID_BACK_PRESSURE_STATS_ABSENT)) {
				return CompletableFuture.completedFuture(OperatorBackPressureStatsResponse.of(null));
			} else {
				throw new AssertionError();
			}
		}
	).build();
	jobVertexBackPressureHandler = new JobVertexBackPressureHandler(
		() -> CompletableFuture.completedFuture(restfulGateway),
		Time.seconds(10),
		Collections.emptyMap(),
		JobVertexBackPressureHeaders.getInstance()
	);
}