use of org.apache.heron.instance.InstanceControlMsg in project heron by twitter.
the class StreamManagerClient method handleCheckpointSaved.
private void handleCheckpointSaved(CheckpointManager.StatefulConsistentCheckpointSaved message) {
LOG.info("Received a StatefulCheckpointSaved message with checkpoint id: " + message.getConsistentCheckpoint().getCheckpointId());
InstanceControlMsg instanceControlMsg = InstanceControlMsg.newBuilder().setStatefulCheckpointSaved(message).build();
inControlQueue.offer(instanceControlMsg);
}
use of org.apache.heron.instance.InstanceControlMsg in project heron by twitter.
the class AbstractTupleRoutingTest method testRoundRobinRouting.
/**
* Test that tuple routing occurs using round robin
*/
@Test
public void testRoundRobinRouting() throws Exception {
PhysicalPlanHelper physicalPlanHelper = new PhysicalPlanHelper(constructPhysicalPlan(), getComponentToVerify().getInstanceId());
InstanceControlMsg instanceControlMsg = InstanceControlMsg.newBuilder().setNewPhysicalPlanHelper(physicalPlanHelper).build();
executorTester.getInControlQueue().offer(instanceControlMsg);
SingletonRegistry.INSTANCE.registerSingleton(getInitInfoKey(getComponentToVerify().getName()), groupingInitInfo);
final int expectedTuplesValidated = 10;
Runnable task = new Runnable() {
@Override
public void run() {
HeronServerTester.await(outStreamQueueOfferLatch);
assertNotEquals(0, executorTester.getOutStreamQueue().size());
while (tupleReceived < expectedTuplesValidated) {
if (executorTester.getOutStreamQueue().isEmpty()) {
continue;
}
Message msg = executorTester.getOutStreamQueue().poll();
assertTrue(msg instanceof HeronTuples.HeronTupleSet);
HeronTuples.HeronTupleSet set = (HeronTuples.HeronTupleSet) msg;
assertTrue(set.isInitialized());
assertFalse(set.hasControl());
assertTrue(set.hasData());
HeronTuples.HeronDataTupleSet dataTupleSet = set.getData();
assertEquals(dataTupleSet.getStream().getId(), "default");
assertEquals(dataTupleSet.getStream().getComponentName(), getComponentToVerify().getName());
for (HeronTuples.HeronDataTuple dataTuple : dataTupleSet.getTuplesList()) {
List<Integer> destTaskIds = dataTuple.getDestTaskIdsList();
assertEquals(1, destTaskIds.size());
assertEquals((Integer) tupleReceived, destTaskIds.get(0));
tupleReceived++;
}
}
assertEquals(expectedTuplesValidated, tupleReceived);
assertEquals(getExpectedComponentInitInfo(), groupingInitInfo.toString());
executorTester.getTestLooper().exitLoop();
}
};
executorTester.getTestLooper().addTasksOnWakeup(task);
executorTester.getTestLooper().loop();
assertEquals(expectedTuplesValidated, tupleReceived);
}
use of org.apache.heron.instance.InstanceControlMsg in project heron by twitter.
the class StreamManagerClient method handleRestoreInstanceStateRequest.
private void handleRestoreInstanceStateRequest(CheckpointManager.RestoreInstanceStateRequest request) {
LOG.info("Received a RestoreInstanceState request with checkpoint id: " + request.getState().getCheckpointId());
InstanceControlMsg instanceControlMsg = InstanceControlMsg.newBuilder().setRestoreInstanceStateRequest(request).build();
inControlQueue.offer(instanceControlMsg);
}
use of org.apache.heron.instance.InstanceControlMsg in project heron by twitter.
the class StreamManagerClient method handleAssignmentMessage.
private void handleAssignmentMessage(PhysicalPlans.PhysicalPlan pplan) {
LOG.fine("Physical Plan: " + pplan);
PhysicalPlanHelper newHelper = new PhysicalPlanHelper(pplan, instance.getInstanceId());
if (helper != null && (!helper.getMyComponent().equals(newHelper.getMyComponent()) || helper.getMyTaskId() != newHelper.getMyTaskId())) {
// we will get the new assignment
throw new RuntimeException("Our Assignment has changed. We will die to pick it");
}
if (helper == null) {
LOG.info("We received a new Physical Plan.");
} else {
LOG.info("We received a new Physical Plan with same assignment. Should be state changes.");
LOG.info(String.format("Old state: %s; new sate: %s.", helper.getTopologyState(), newHelper.getTopologyState()));
}
helper = newHelper;
LOG.info("Push to Executor");
InstanceControlMsg instanceControlMsg = InstanceControlMsg.newBuilder().setNewPhysicalPlanHelper(helper).build();
inControlQueue.offer(instanceControlMsg);
}
use of org.apache.heron.instance.InstanceControlMsg in project heron by twitter.
the class StreamManagerClient method handleStartStatefulRequest.
private void handleStartStatefulRequest(CheckpointManager.StartInstanceStatefulProcessing request) {
LOG.info("Received a StartInstanceStatefulProcessing request: " + request);
InstanceControlMsg instanceControlMsg = InstanceControlMsg.newBuilder().setStartInstanceStatefulProcessing(request).build();
inControlQueue.offer(instanceControlMsg);
}
Aggregations