use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class TestMemoryWorkerCrash method waitForNodes.
private void waitForNodes(int numberOfNodes) throws InterruptedException {
DistributedQueryRunner queryRunner = (DistributedQueryRunner) getQueryRunner();
long start = System.nanoTime();
while (queryRunner.getCoordinator().refreshNodes().getActiveNodes().size() < numberOfNodes) {
assertLessThan(nanosSince(start), new Duration(10, SECONDS));
MILLISECONDS.sleep(10);
}
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class PostgreSqlQueryRunner method createPostgreSqlQueryRunner.
public static QueryRunner createPostgreSqlQueryRunner(TestingPostgreSqlServer server, Map<String, String> connectorProperties, Iterable<TpchTable<?>> tables) throws Exception {
DistributedQueryRunner queryRunner = null;
try {
queryRunner = new DistributedQueryRunner(createSession(), 3);
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
connectorProperties = new HashMap<>(ImmutableMap.copyOf(connectorProperties));
connectorProperties.putIfAbsent("connection-url", server.getJdbcUrl());
connectorProperties.putIfAbsent("allow-drop-table", "true");
createSchema(server.getJdbcUrl(), "tpch");
queryRunner.installPlugin(new PostgreSqlPlugin());
queryRunner.createCatalog("postgresql", "postgresql", connectorProperties);
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables);
return queryRunner;
} catch (Throwable e) {
closeAllSuppress(e, queryRunner, server);
throw e;
}
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class RaptorQueryRunner method main.
public static void main(String[] args) throws Exception {
Logging.initialize();
Map<String, String> properties = ImmutableMap.of("http-server.http.port", "8080");
DistributedQueryRunner queryRunner = createRaptorQueryRunner(properties, true, false, false);
Thread.sleep(10);
Logger log = Logger.get(RaptorQueryRunner.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 TestResourceGroupIntegration method testPathToRoot.
@Test
public void testPathToRoot() throws Exception {
try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder().build()) {
queryRunner.installPlugin(new ResourceGroupManagerPlugin());
InternalResourceGroupManager<?> manager = getResourceGroupManager(queryRunner);
manager.setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_config_dashboard.json")));
queryRunner.execute(testSessionBuilder().setCatalog("tpch").setSchema("tiny").setSource("dashboard-foo").build(), "SELECT COUNT(*), clerk FROM orders GROUP BY clerk");
List<ResourceGroupInfo> path = manager.getPathToRoot(new ResourceGroupId(new ResourceGroupId(new ResourceGroupId("global"), "user-user"), "dashboard-user"));
assertEquals(path.size(), 3);
assertTrue(path.get(1).getSubGroups() != null);
assertEquals(path.get(2).getId(), new ResourceGroupId("global"));
assertEquals(path.get(2).getHardConcurrencyLimit(), 100);
assertEquals(path.get(2).getRunningQueries(), null);
}
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class H2TestUtil method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(String dbConfigUrl, H2ResourceGroupsDao dao, String environment, Map<String, String> coordinatorProperties, int coordinatorCount) throws Exception {
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(testSessionBuilder().setCatalog("tpch").setSchema("tiny").build()).setNodeCount(2).setCoordinatorCount(coordinatorCount).setEnvironment(environment).setResourceManagerEnabled(true).setCoordinatorProperties(coordinatorProperties).build();
try {
Plugin h2ResourceGroupManagerPlugin = new H2ResourceGroupManagerPlugin();
queryRunner.installPlugin(h2ResourceGroupManagerPlugin);
for (int coordinator = 0; coordinator < coordinatorCount; coordinator++) {
queryRunner.getCoordinator(coordinator).getResourceGroupManager().get().setConfigurationManager(CONFIGURATION_MANAGER_TYPE, ImmutableMap.of("resource-groups.config-db-url", dbConfigUrl, "node.environment", environment));
}
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
setup(queryRunner, dao, environment);
queryRunner.waitForClusterToGetReady();
return queryRunner;
} catch (Exception e) {
queryRunner.close();
throw e;
}
}
Aggregations