Search in sources :

Example 1 with JobSetup

use of io.crate.execution.jobs.JobSetup in project crate by crate.

the class DocLevelCollectTest method collect.

private Bucket collect(RoutedCollectPhase collectNode) throws Throwable {
    JobSetup jobSetup = internalCluster().getDataNodeInstance(JobSetup.class);
    TasksService tasksService = internalCluster().getDataNodeInstance(TasksService.class);
    SharedShardContexts sharedShardContexts = new SharedShardContexts(internalCluster().getDataNodeInstance(IndicesService.class), UnaryOperator.identity());
    RootTask.Builder builder = tasksService.newBuilder(collectNode.jobId());
    NodeOperation nodeOperation = NodeOperation.withDirectResponse(collectNode, mock(ExecutionPhase.class), (byte) 0, "remoteNode");
    List<CompletableFuture<StreamBucket>> results = jobSetup.prepareOnRemote(DUMMY_SESSION_INFO, List.of(nodeOperation), builder, sharedShardContexts);
    RootTask rootTask = tasksService.createTask(builder);
    rootTask.start();
    return results.get(0).get(2, TimeUnit.SECONDS);
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) SharedShardContexts(io.crate.execution.jobs.SharedShardContexts) JobSetup(io.crate.execution.jobs.JobSetup) IndicesService(org.elasticsearch.indices.IndicesService) TasksService(io.crate.execution.jobs.TasksService) NodeOperation(io.crate.execution.dsl.phases.NodeOperation) ExecutionPhase(io.crate.execution.dsl.phases.ExecutionPhase) RootTask(io.crate.execution.jobs.RootTask)

Aggregations

ExecutionPhase (io.crate.execution.dsl.phases.ExecutionPhase)1 NodeOperation (io.crate.execution.dsl.phases.NodeOperation)1 JobSetup (io.crate.execution.jobs.JobSetup)1 RootTask (io.crate.execution.jobs.RootTask)1 SharedShardContexts (io.crate.execution.jobs.SharedShardContexts)1 TasksService (io.crate.execution.jobs.TasksService)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 IndicesService (org.elasticsearch.indices.IndicesService)1