Search in sources :

Example 1 with JettyHttpClient

use of com.facebook.airlift.http.client.jetty.JettyHttpClient in project presto by prestodb.

the class TestClusterStatsResource method setup.

@BeforeClass
public void setup() throws Exception {
    client = new JettyHttpClient();
    DistributedQueryRunner runner = createQueryRunner(ImmutableMap.of("query.client.timeout", "20s"));
    server = runner.getCoordinator();
    server.getResourceGroupManager().get().addConfigurationManagerFactory(new FileResourceGroupConfigurationManagerFactory());
    server.getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_config_simple.json")));
}
Also used : DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) JettyHttpClient(com.facebook.airlift.http.client.jetty.JettyHttpClient) FileResourceGroupConfigurationManagerFactory(com.facebook.presto.resourceGroups.FileResourceGroupConfigurationManagerFactory) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with JettyHttpClient

use of com.facebook.airlift.http.client.jetty.JettyHttpClient in project presto by prestodb.

the class TestTaskInfoResource method setup.

@BeforeClass
public void setup() throws Exception {
    this.client = new JettyHttpClient();
    this.queryRunner = createQueryRunner(ImmutableMap.of("query.client.timeout", "10s"));
    this.server = queryRunner.getCoordinator();
}
Also used : JettyHttpClient(com.facebook.airlift.http.client.jetty.JettyHttpClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with JettyHttpClient

use of com.facebook.airlift.http.client.jetty.JettyHttpClient in project presto by prestodb.

the class TestDistributedClusterStatsResource method setup.

@BeforeClass
public void setup() throws Exception {
    client = new JettyHttpClient();
    DistributedQueryRunner runner = createQueryRunner(ImmutableMap.of("resource-manager.query-expiration-timeout", "4m", "resource-manager.completed-query-expiration-timeout", "4m"), ImmutableMap.of("query.client.timeout", "20s", "resource-manager.query-heartbeat-interval", "100ms", "resource-group-runtimeinfo-refresh-interval", "100ms", "concurrency-threshold-to-enable-resource-group-refresh", "0.1"), ImmutableMap.of(), COORDINATOR_COUNT);
    coordinator1 = runner.getCoordinator(0);
    coordinator2 = runner.getCoordinator(1);
    Optional<TestingPrestoServer> resourceManager = runner.getResourceManager();
    checkState(resourceManager.isPresent(), "resource manager not present");
    this.resourceManager = resourceManager.get();
    runner.getCoordinators().stream().forEach(coordinator -> {
        coordinator.getResourceGroupManager().get().addConfigurationManagerFactory(new FileResourceGroupConfigurationManagerFactory());
        coordinator.getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath(RESOURCE_GROUPS_CONFIG_FILE)));
    });
}
Also used : DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) JettyHttpClient(com.facebook.airlift.http.client.jetty.JettyHttpClient) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) FileResourceGroupConfigurationManagerFactory(com.facebook.presto.resourceGroups.FileResourceGroupConfigurationManagerFactory) BeforeClass(org.testng.annotations.BeforeClass)

Example 4 with JettyHttpClient

use of com.facebook.airlift.http.client.jetty.JettyHttpClient in project presto by prestodb.

the class TestQueryResource method setup.

@BeforeClass
public void setup() throws Exception {
    client = new JettyHttpClient();
    DistributedQueryRunner runner = createQueryRunner(ImmutableMap.of("query.client.timeout", "10s"));
    server = runner.getCoordinator();
    server.getResourceGroupManager().get().addConfigurationManagerFactory(new FileResourceGroupConfigurationManagerFactory());
    server.getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_config_simple.json")));
}
Also used : DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) JettyHttpClient(com.facebook.airlift.http.client.jetty.JettyHttpClient) FileResourceGroupConfigurationManagerFactory(com.facebook.presto.resourceGroups.FileResourceGroupConfigurationManagerFactory) BeforeClass(org.testng.annotations.BeforeClass)

Example 5 with JettyHttpClient

use of com.facebook.airlift.http.client.jetty.JettyHttpClient in project presto by prestodb.

the class QueryStatsClientModuleProvider method getModule.

@Override
public Module getModule(Configuration configuration) {
    return new PrivateModule() {

        @Override
        protected void configure() {
            bind(ObjectMapper.class).toProvider(JsonObjectMapperProvider.class);
        }

        @Inject
        @Provides
        @Exposed
        QueryStatsClient getQueryStatsClient(ObjectMapper objectMapper, @Named("databases.presto.server_address") String serverAddress) {
            // @Singleton does not work due: https://github.com/prestodb/tempto/issues/94
            if (httpQueryStatsClient == null) {
                HttpClientConfig httpClientConfig = new HttpClientConfig();
                httpClientConfig.setKeyStorePath(configuration.getString("databases.presto.https_keystore_path").orElse(null));
                httpClientConfig.setKeyStorePassword(configuration.getString("databases.presto.https_keystore_password").orElse(null));
                httpQueryStatsClient = new HttpQueryStatsClient(new JettyHttpClient(httpClientConfig), objectMapper, URI.create(serverAddress));
            }
            return httpQueryStatsClient;
        }
    };
}
Also used : Named(javax.inject.Named) HttpClientConfig(com.facebook.airlift.http.client.HttpClientConfig) JettyHttpClient(com.facebook.airlift.http.client.jetty.JettyHttpClient) PrivateModule(com.google.inject.PrivateModule) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

JettyHttpClient (com.facebook.airlift.http.client.jetty.JettyHttpClient)12 TestingPrestoServer (com.facebook.presto.server.testing.TestingPrestoServer)7 BeforeClass (org.testng.annotations.BeforeClass)7 FileResourceGroupConfigurationManagerFactory (com.facebook.presto.resourceGroups.FileResourceGroupConfigurationManagerFactory)6 DistributedQueryRunner (com.facebook.presto.tests.DistributedQueryRunner)6 BeforeMethod (org.testng.annotations.BeforeMethod)4 HttpClient (com.facebook.airlift.http.client.HttpClient)1 HttpClientConfig (com.facebook.airlift.http.client.HttpClientConfig)1 HttpRequestFilter (com.facebook.airlift.http.client.HttpRequestFilter)1 JsonObjectMapperProvider (com.facebook.airlift.json.JsonObjectMapperProvider)1 VariableReferenceExpression (com.facebook.presto.spi.relation.VariableReferenceExpression)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1 PrivateModule (com.google.inject.PrivateModule)1 Named (javax.inject.Named)1