Search in sources :

Example 1 with JobConfigInfo

use of org.apache.flink.runtime.rest.messages.JobConfigInfo 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)));
}
Also used : JobConfigInfo(org.apache.flink.runtime.rest.messages.JobConfigInfo) ArchivedExecutionConfig(org.apache.flink.api.common.ArchivedExecutionConfig) HashMap(java.util.HashMap) DefaultExecutionGraphCache(org.apache.flink.runtime.rest.handler.legacy.DefaultExecutionGraphCache) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder) ArchivedExecutionConfigBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionConfigBuilder) EmptyRequestBody(org.apache.flink.runtime.rest.messages.EmptyRequestBody) Test(org.junit.Test)

Example 2 with JobConfigInfo

use of org.apache.flink.runtime.rest.messages.JobConfigInfo in project flink by apache.

the class JobConfigHandler method createJobConfigInfo.

private static JobConfigInfo createJobConfigInfo(AccessExecutionGraph executionGraph) {
    final ArchivedExecutionConfig executionConfig = executionGraph.getArchivedExecutionConfig();
    final JobConfigInfo.ExecutionConfigInfo executionConfigInfo;
    if (executionConfig != null) {
        executionConfigInfo = JobConfigInfo.ExecutionConfigInfo.from(executionConfig);
    } else {
        executionConfigInfo = null;
    }
    return new JobConfigInfo(executionGraph.getJobID(), executionGraph.getJobName(), executionConfigInfo);
}
Also used : JobConfigInfo(org.apache.flink.runtime.rest.messages.JobConfigInfo) ArchivedExecutionConfig(org.apache.flink.api.common.ArchivedExecutionConfig)

Aggregations

ArchivedExecutionConfig (org.apache.flink.api.common.ArchivedExecutionConfig)2 JobConfigInfo (org.apache.flink.runtime.rest.messages.JobConfigInfo)2 HashMap (java.util.HashMap)1 AccessExecutionGraph (org.apache.flink.runtime.executiongraph.AccessExecutionGraph)1 DefaultExecutionGraphCache (org.apache.flink.runtime.rest.handler.legacy.DefaultExecutionGraphCache)1 ArchivedExecutionConfigBuilder (org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionConfigBuilder)1 ArchivedExecutionGraphBuilder (org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder)1 EmptyRequestBody (org.apache.flink.runtime.rest.messages.EmptyRequestBody)1 Test (org.junit.Test)1