use of org.apache.drill.exec.rpc.control.Controller in project drill by axbaretto.
the class QueryManager method unpauseExecutingFragments.
/**
* Sends a resume signal to all fragments, regardless of their state, since the fragment might have paused before
* sending any message. Resume all fragments through the control tunnel.
*/
void unpauseExecutingFragments(final DrillbitContext drillbitContext) {
@SuppressWarnings("resource") final Controller controller = drillbitContext.getController();
for (final FragmentData data : fragmentDataSet) {
final DrillbitEndpoint endpoint = data.getEndpoint();
final FragmentHandle handle = data.getHandle();
controller.getTunnel(endpoint).unpauseFragment(new SignalListener(endpoint, handle, SignalListener.Signal.UNPAUSE), handle);
}
}
use of org.apache.drill.exec.rpc.control.Controller in project drill by apache.
the class QueryManager method cancelExecutingFragments.
/**
* Stop all fragments with currently *known* active status (active as in SENDING, AWAITING_ALLOCATION, RUNNING).
*
* For the actual cancel calls for intermediate and leaf fragments, see
* {@link org.apache.drill.exec.work.batch.ControlMessageHandler#cancelFragment}
* (1) Root fragment: pending or running, send the cancel signal through a tunnel.
* (2) Intermediate fragment: pending or running, send the cancel signal through a tunnel (for local and remote
* fragments). The actual cancel is done by delegating the cancel to the work bus.
* (3) Leaf fragment: running, send the cancel signal through a tunnel. The cancel is done directly.
*/
void cancelExecutingFragments(final DrillbitContext drillbitContext) {
final Controller controller = drillbitContext.getController();
for (final FragmentData data : fragmentDataSet) {
switch(data.getState()) {
case SENDING:
case AWAITING_ALLOCATION:
case RUNNING:
final FragmentHandle handle = data.getHandle();
final DrillbitEndpoint endpoint = data.getEndpoint();
// TODO is the CancelListener redundant? Does the FragmentStatusListener get notified of the same?
controller.getTunnel(endpoint).cancelFragment(new SignalListener(endpoint, handle, SignalListener.Signal.CANCEL), handle);
break;
case FINISHED:
case CANCELLATION_REQUESTED:
case CANCELLED:
case FAILED:
// nothing to do
break;
}
}
}
use of org.apache.drill.exec.rpc.control.Controller in project drill by apache.
the class QueryManager method unpauseExecutingFragments.
/**
* Sends a resume signal to all fragments, regardless of their state, since the fragment might have paused before
* sending any message. Resume all fragments through the control tunnel.
*/
void unpauseExecutingFragments(final DrillbitContext drillbitContext) {
final Controller controller = drillbitContext.getController();
for (final FragmentData data : fragmentDataSet) {
final DrillbitEndpoint endpoint = data.getEndpoint();
final FragmentHandle handle = data.getHandle();
controller.getTunnel(endpoint).unpauseFragment(new SignalListener(endpoint, handle, SignalListener.Signal.UNPAUSE), handle);
}
}
use of org.apache.drill.exec.rpc.control.Controller in project drill by apache.
the class FragmentStatusReporterTest method setUp.
@Before
public void setUp() throws Exception {
final FragmentContextImpl context = mock(FragmentContextImpl.class);
Controller controller = mock(Controller.class);
// Create Foreman Endpoint and it's tunnel
DrillbitEndpoint foremanEndpoint = DrillbitEndpoint.newBuilder().setAddress("10.0.0.2").build();
foremanTunnel = mock(ControlTunnel.class);
when(context.getController()).thenReturn(controller);
when(controller.getTunnel(foremanEndpoint)).thenReturn(foremanTunnel);
when(context.getStats()).thenReturn(mock(FragmentStats.class));
when(context.getHandle()).thenReturn(FragmentHandle.getDefaultInstance());
when(context.getAllocator()).thenReturn(mock(BufferAllocator.class));
when(context.getForemanEndpoint()).thenReturn(foremanEndpoint);
statusReporter = new FragmentStatusReporter(context);
}
use of org.apache.drill.exec.rpc.control.Controller in project drill by apache.
the class Foreman method sendRemoteFragments.
/**
* Send all the remote fragments belonging to a single target drillbit in one request.
*
* @param assignment the drillbit assigned to these fragments
* @param fragments the set of fragments
* @param latch the countdown latch used to track the requests to all endpoints
* @param fragmentSubmitFailures the submission failure counter used to track the requests to all endpoints
*/
private void sendRemoteFragments(final DrillbitEndpoint assignment, final Collection<PlanFragment> fragments, final CountDownLatch latch, final FragmentSubmitFailures fragmentSubmitFailures) {
@SuppressWarnings("resource") final Controller controller = drillbitContext.getController();
final InitializeFragments.Builder fb = InitializeFragments.newBuilder();
for (final PlanFragment planFragment : fragments) {
fb.addFragment(planFragment);
}
final InitializeFragments initFrags = fb.build();
logger.debug("Sending remote fragments to \nNode:\n{} \n\nData:\n{}", assignment, initFrags);
final FragmentSubmitListener listener = new FragmentSubmitListener(assignment, initFrags, latch, fragmentSubmitFailures);
controller.getTunnel(assignment).sendFragments(listener, initFrags);
}
Aggregations