use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class TestQueues method testTwoQueriesAtSameTime.
@Test(timeOut = 240_000)
public void testTwoQueriesAtSameTime() throws Exception {
String dbConfigUrl = getDbConfigUrl();
H2ResourceGroupsDao dao = getDao(dbConfigUrl);
try (DistributedQueryRunner queryRunner = createQueryRunner(dbConfigUrl, dao)) {
QueryId firstDashboardQuery = createQuery(queryRunner, newDashboardSession(), LONG_LASTING_QUERY);
QueryId secondDashboardQuery = createQuery(queryRunner, newDashboardSession(), LONG_LASTING_QUERY);
ImmutableSet<QueryState> queuedOrRunning = ImmutableSet.of(QUEUED, RUNNING);
waitForQueryState(queryRunner, firstDashboardQuery, RUNNING);
waitForQueryState(queryRunner, secondDashboardQuery, QUEUED);
}
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class TpchQueryRunner method main.
public static void main(String[] args) throws Exception {
Logging.initialize();
DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080"));
Thread.sleep(10);
Logger log = Logger.get(TpchQueryRunner.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 TpchQueryRunner method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties, int coordinatorCount) throws Exception {
DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder().setExtraProperties(extraProperties).setResourceManagerEnabled(true).setCoordinatorCount(coordinatorCount).build();
queryRunner.waitForClusterToGetReady();
return queryRunner;
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class OracleQueryRunner method createOracleQueryRunner.
public static DistributedQueryRunner createOracleQueryRunner(TestingOracleServer server, Iterable<TpchTable<?>> tables) throws Exception {
DistributedQueryRunner queryRunner = null;
try {
queryRunner = DistributedQueryRunner.builder(createSession()).build();
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
Map<String, String> connectorProperties = new HashMap<>();
connectorProperties.putIfAbsent("connection-url", server.getJdbcUrl());
connectorProperties.putIfAbsent("connection-user", TestingOracleServer.TEST_USER);
connectorProperties.putIfAbsent("connection-password", TestingOracleServer.TEST_PASS);
connectorProperties.putIfAbsent("allow-drop-table", "true");
queryRunner.installPlugin(new OraclePlugin());
queryRunner.createCatalog("oracle", "oracle", 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 TestMemoryWorkerCrash method closeWorker.
private void closeWorker() throws Exception {
int nodeCount = getNodeCount();
DistributedQueryRunner queryRunner = (DistributedQueryRunner) getQueryRunner();
TestingPrestoServer worker = queryRunner.getServers().stream().filter(server -> !server.isCoordinator()).findAny().orElseThrow(() -> new IllegalStateException("No worker nodes"));
worker.close();
waitForNodes(nodeCount - 1);
}
Aggregations