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);
}
Aggregations