use of org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder in project flink by apache.
the class MiniDispatcherTest method testShutdownIfJobCancelledInNormalMode.
@Test
public void testShutdownIfJobCancelledInNormalMode() throws Exception {
final MiniDispatcher miniDispatcher = createMiniDispatcher(ClusterEntrypoint.ExecutionMode.NORMAL);
miniDispatcher.start();
try {
// wait until we have submitted the job
final TestingJobManagerRunner testingJobManagerRunner = testingJobManagerRunnerFactory.takeCreatedJobManagerRunner();
assertFalse(miniDispatcher.getTerminationFuture().isDone());
final DispatcherGateway dispatcherGateway = miniDispatcher.getSelfGateway(DispatcherGateway.class);
dispatcherGateway.cancelJob(jobGraph.getJobID(), Time.seconds(10L));
testingJobManagerRunner.completeResultFuture(new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().setJobID(jobGraph.getJobID()).setState(JobStatus.CANCELED).build()));
ApplicationStatus applicationStatus = miniDispatcher.getShutDownFuture().get();
assertThat(applicationStatus, is(ApplicationStatus.CANCELED));
} finally {
RpcUtils.terminateRpcEndpoint(miniDispatcher, timeout);
}
}
use of org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder in project flink by apache.
the class MiniDispatcherTest method setupClass.
@BeforeClass
public static void setupClass() throws IOException {
jobGraph = JobGraphTestUtils.singleNoOpJobGraph();
executionGraphInfo = new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().setJobID(jobGraph.getJobID()).setState(JobStatus.FINISHED).build());
rpcService = new TestingRpcService();
configuration = new Configuration();
blobServer = new BlobServer(configuration, temporaryFolder.newFolder(), new VoidBlobStore());
}
use of org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder in project flink by apache.
the class MemoryExecutionGraphInfoStoreTest method testCloseCleansUp.
/**
* Tests that all job graphs are cleaned up after closing the store.
*/
@Test
public void testCloseCleansUp() throws IOException {
try (final MemoryExecutionGraphInfoStore executionGraphInfoStore = createMemoryExecutionGraphInfoStore()) {
assertThat(executionGraphInfoStore.size(), Matchers.equalTo(0));
executionGraphInfoStore.put(new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().setState(JobStatus.FINISHED).build()));
assertThat(executionGraphInfoStore.size(), Matchers.equalTo(1));
executionGraphInfoStore.close();
assertThat(executionGraphInfoStore.size(), Matchers.equalTo(0));
}
}
use of org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder in project flink by apache.
the class JobConfigHandlerTest method handleRequest_executionConfigWithSecretValues_excludesSecretValuesFromResponse.
@Test
public void handleRequest_executionConfigWithSecretValues_excludesSecretValuesFromResponse() throws HandlerRequestException {
final JobConfigHandler jobConfigHandler = new JobConfigHandler(() -> null, TestingUtils.TIMEOUT, Collections.emptyMap(), JobConfigHeaders.getInstance(), new DefaultExecutionGraphCache(TestingUtils.TIMEOUT, TestingUtils.TIMEOUT), TestingUtils.defaultExecutor());
final Map<String, String> globalJobParameters = new HashMap<>();
globalJobParameters.put("foobar", "barfoo");
globalJobParameters.put("bar.secret.foo", "my secret");
globalJobParameters.put("password.to.my.safe", "12345");
final ArchivedExecutionConfig archivedExecutionConfig = new ArchivedExecutionConfigBuilder().setGlobalJobParameters(globalJobParameters).build();
final AccessExecutionGraph archivedExecutionGraph = new ArchivedExecutionGraphBuilder().setArchivedExecutionConfig(archivedExecutionConfig).build();
final HandlerRequest<EmptyRequestBody> handlerRequest = createRequest(archivedExecutionGraph.getJobID());
final JobConfigInfo jobConfigInfoResponse = jobConfigHandler.handleRequest(handlerRequest, archivedExecutionGraph);
final Map<String, String> filteredGlobalJobParameters = filterSecretValues(globalJobParameters);
assertThat(jobConfigInfoResponse.getExecutionConfigInfo().getGlobalJobParameters(), is(equalTo(filteredGlobalJobParameters)));
}
use of org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder in project flink by apache.
the class JobExecutionResultHandlerTest method testCompletedResult.
@Test
public void testCompletedResult() throws Exception {
final JobStatus jobStatus = JobStatus.FINISHED;
final ArchivedExecutionGraph executionGraph = new ArchivedExecutionGraphBuilder().setJobID(TEST_JOB_ID).setState(jobStatus).build();
final TestingRestfulGateway testingRestfulGateway = new TestingRestfulGateway.Builder().setRequestJobStatusFunction(jobId -> {
assertThat(jobId, equalTo(TEST_JOB_ID));
return CompletableFuture.completedFuture(jobStatus);
}).setRequestJobResultFunction(jobId -> {
assertThat(jobId, equalTo(TEST_JOB_ID));
return CompletableFuture.completedFuture(JobResult.createFrom(executionGraph));
}).build();
final JobExecutionResultResponseBody responseBody = jobExecutionResultHandler.handleRequest(testRequest, testingRestfulGateway).get();
assertThat(responseBody.getStatus().getId(), equalTo(QueueStatus.Id.COMPLETED));
assertThat(responseBody.getJobExecutionResult(), not(nullValue()));
}
Aggregations