Search in sources :

Example 16 with DrillbitContext

use of org.apache.drill.exec.server.DrillbitContext in project drill by apache.

the class ControlMessageHandler method startNewRemoteFragment.

private void startNewRemoteFragment(final PlanFragment fragment) throws UserRpcException {
    logger.debug("Received remote fragment start instruction", fragment);
    final DrillbitContext drillbitContext = bee.getContext();
    try {
        // we either need to start the fragment if it is a leaf fragment, or set up a fragment manager if it is non leaf.
        if (fragment.getLeafFragment()) {
            final FragmentContext context = new FragmentContext(drillbitContext, fragment, drillbitContext.getFunctionImplementationRegistry());
            final ControlTunnel tunnel = drillbitContext.getController().getTunnel(fragment.getForeman());
            final FragmentStatusReporter statusReporter = new FragmentStatusReporter(context, tunnel);
            final FragmentExecutor fr = new FragmentExecutor(context, fragment, statusReporter);
            bee.addFragmentRunner(fr);
        } else {
            // isIntermediate, store for incoming data.
            final NonRootFragmentManager manager = new NonRootFragmentManager(fragment, drillbitContext);
            drillbitContext.getWorkBus().addFragmentManager(manager);
        }
    } catch (final Exception e) {
        throw new UserRpcException(drillbitContext.getEndpoint(), "Failure while trying to start remote fragment", e);
    } catch (final OutOfMemoryError t) {
        if (t.getMessage().startsWith("Direct buffer")) {
            throw new UserRpcException(drillbitContext.getEndpoint(), "Out of direct memory while trying to start remote fragment", t);
        } else {
            throw t;
        }
    }
}
Also used : DrillbitContext(org.apache.drill.exec.server.DrillbitContext) ControlTunnel(org.apache.drill.exec.rpc.control.ControlTunnel) NonRootFragmentManager(org.apache.drill.exec.work.fragment.NonRootFragmentManager) UserRpcException(org.apache.drill.exec.rpc.UserRpcException) FragmentContext(org.apache.drill.exec.ops.FragmentContext) FragmentStatusReporter(org.apache.drill.exec.work.fragment.FragmentStatusReporter) FragmentExecutor(org.apache.drill.exec.work.fragment.FragmentExecutor) UserRpcException(org.apache.drill.exec.rpc.UserRpcException) RpcException(org.apache.drill.exec.rpc.RpcException)

Example 17 with DrillbitContext

use of org.apache.drill.exec.server.DrillbitContext in project drill by apache.

the class WorkManager method start.

public void start(final DrillbitEndpoint endpoint, final Controller controller, final DataConnectionCreator data, final ClusterCoordinator coord, final PersistentStoreProvider provider, final PersistentStoreProvider profilesProvider) {
    dContext = new DrillbitContext(endpoint, bContext, coord, controller, data, workBus, provider, profilesProvider);
    statusThread.start();
    DrillMetrics.register("drill.fragments.running", new Gauge<Integer>() {

        @Override
        public Integer getValue() {
            return runningFragments.size();
        }
    });
}
Also used : DrillbitContext(org.apache.drill.exec.server.DrillbitContext)

Aggregations

DrillbitContext (org.apache.drill.exec.server.DrillbitContext)17 Test (org.junit.Test)8 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)5 PhysicalPlanReader (org.apache.drill.exec.planner.PhysicalPlanReader)5 DrillbitEndpoint (org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint)5 Drillbit (org.apache.drill.exec.server.Drillbit)5 RemoteServiceSet (org.apache.drill.exec.server.RemoteServiceSet)5 DrillConfig (org.apache.drill.common.config.DrillConfig)4 FragmentContext (org.apache.drill.exec.ops.FragmentContext)4 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)4 QueryContext (org.apache.drill.exec.ops.QueryContext)3 File (java.io.File)2 IOException (java.io.IOException)2 ZookeeperHelper (org.apache.drill.exec.ZookeeperHelper)2 DrillbitStartupException (org.apache.drill.exec.exception.DrillbitStartupException)2 OutOfMemoryException (org.apache.drill.exec.exception.OutOfMemoryException)2 FragmentRoot (org.apache.drill.exec.physical.base.FragmentRoot)2 PhysicalOperator (org.apache.drill.exec.physical.base.PhysicalOperator)2 Fragment (org.apache.drill.exec.planner.fragment.Fragment)2 PlanningSet (org.apache.drill.exec.planner.fragment.PlanningSet)2