use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class TestFinalQueryInfo method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(Session session) throws Exception {
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session).setNodeCount(2).build();
try {
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
return queryRunner;
} catch (Exception e) {
queryRunner.close();
throw e;
}
}
use of com.facebook.presto.tests.DistributedQueryRunner 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)));
});
}
use of com.facebook.presto.tests.DistributedQueryRunner 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")));
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class PrometheusQueryRunner method main.
public static void main(String[] args) throws Exception {
Logging.initialize();
DistributedQueryRunner queryRunner = createPrometheusQueryRunner(new PrometheusServer());
Thread.sleep(10);
Logger log = Logger.get(PrometheusQueryRunner.class);
log.info("======== SERVER STARTED ========");
log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class AbstractDeltaDistributedQueryTestBase method createDeltaQueryRunner.
private static DistributedQueryRunner createDeltaQueryRunner(Map<String, String> extraProperties) throws Exception {
Session session = testSessionBuilder().setCatalog(DELTA_CATALOG).setSchema(DELTA_SCHEMA.toLowerCase(US)).setTimeZoneKey(UTC_KEY).build();
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session).setExtraProperties(extraProperties).build();
// Install the TPCH plugin for test data (not in Delta format)
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
Path dataDir = queryRunner.getCoordinator().getBaseDataDir().resolve("delta_metadata");
Path catalogDir = dataDir.getParent().resolve("catalog");
// Install a Delta connector catalog
queryRunner.installPlugin(new DeltaPlugin());
Map<String, String> deltaProperties = ImmutableMap.<String, String>builder().put("hive.metastore", "file").put("hive.metastore.catalog.dir", catalogDir.toFile().toURI().toString()).build();
queryRunner.createCatalog(DELTA_CATALOG, "delta", deltaProperties);
// Install a Hive connector catalog that uses the same metastore as Delta
// This catalog will be used to create tables in metastore as the Delta connector doesn't
// support creating tables yet.
queryRunner.installPlugin(new HivePlugin("hive"));
Map<String, String> hiveProperties = ImmutableMap.<String, String>builder().put("hive.metastore", "file").put("hive.metastore.catalog.dir", catalogDir.toFile().toURI().toString()).put("hive.allow-drop-table", "true").put("hive.security", "legacy").build();
queryRunner.createCatalog(HIVE_CATALOG, "hive", hiveProperties);
queryRunner.execute(format("CREATE SCHEMA %s.%s", HIVE_CATALOG, DELTA_SCHEMA));
return queryRunner;
}
Aggregations