@Override public boolean areAllProcessesDead() throws IOException { return !_isAlive && super.areAllProcessesDead(); }
/** * State Transitions for KILL state. * PRECONDITION: container.kill() was called * PRECONDITION: container != null && currentAssignment != null * @param dynamicState current state * @param staticState static data * @return the next state * @throws Exception on any error */ private static DynamicState handleKill(DynamicState dynamicState, StaticState staticState) throws Exception { assert (dynamicState.container != null); assert (dynamicState.currentAssignment != null); if (dynamicState.container.areAllProcessesDead()) { LOG.info("SLOT {} all processes are dead...", staticState.port); return cleanupCurrentContainer(dynamicState, staticState, dynamicState.pendingLocalization == null ? MachineState.EMPTY : MachineState.WAITING_FOR_BLOB_LOCALIZATION); } LOG.warn("SLOT {} force kill and wait...", staticState.port); dynamicState.container.forceKill(); Time.sleep(staticState.killSleepMs); return dynamicState; }
/** * Clean up a container. * PRECONDITION: All of the processes have died. * @param dynamicState current state * @param staticState static data * @param nextState the next MachineState to go to. * @return the next state. */ private static DynamicState cleanupCurrentContainer(DynamicState dynamicState, StaticState staticState, MachineState nextState) throws Exception { assert (dynamicState.container != null); assert (dynamicState.currentAssignment != null); assert (dynamicState.container.areAllProcessesDead()); dynamicState.container.cleanUp(); staticState.localizer.releaseSlotFor(dynamicState.currentAssignment, staticState.port); DynamicState ret = dynamicState.withCurrentAssignment(null, null); if (nextState != null) { ret = ret.withState(nextState); } return ret; }
Boolean isDead = dynamicState.container.areAllProcessesDead(); if (!isDead) { if (reason == KillReason.ASSIGNMENT_CHANGED || reason == KillReason.BLOB_CHANGED) {
LSWorkerHeartbeat goodhb = mkWorkerHB(topoId, port, execList, Time.currentTimeSecs()); when(container.readHeartbeat()).thenReturn(oldhb, oldhb, goodhb, goodhb); when(container.areAllProcessesDead()).thenReturn(false, false, true);
LSWorkerHeartbeat chb = mkWorkerHB(cTopoId, port, cExecList, Time.currentTimeSecs()); when(cContainer.readHeartbeat()).thenReturn(chb); when(cContainer.areAllProcessesDead()).thenReturn(false, false, true);
LSWorkerHeartbeat chb = mkWorkerHB(cTopoId, port, cExecList, Time.currentTimeSecs()); when(cContainer.readHeartbeat()).thenReturn(chb); when(cContainer.areAllProcessesDead()).thenReturn(false, false, true);
@Override public boolean areAllProcessesDead() throws IOException { return !_isAlive && super.areAllProcessesDead(); }
/** * State Transitions for KILL state. * PRECONDITION: container.kill() was called * PRECONDITION: container != null && currentAssignment != null * @param dynamicState current state * @param staticState static data * @return the next state * @throws Exception on any error */ static DynamicState handleKill(DynamicState dynamicState, StaticState staticState) throws Exception { assert(dynamicState.container != null); assert(dynamicState.currentAssignment != null); if (dynamicState.container.areAllProcessesDead()) { LOG.warn("SLOT {} all processes are dead...", staticState.port); return cleanupCurrentContainer(dynamicState, staticState, dynamicState.pendingLocalization == null ? MachineState.EMPTY : MachineState.WAITING_FOR_BASIC_LOCALIZATION); } LOG.warn("SLOT {} force kill and wait...", staticState.port); dynamicState.container.forceKill(); Time.sleep(staticState.killSleepMs); return dynamicState; }
/** * Clean up a container * PRECONDITION: All of the processes have died. * @param dynamicState current state * @param staticState static data * @param nextState the next MachineState to go to. * @return the next state. */ static DynamicState cleanupCurrentContainer(DynamicState dynamicState, StaticState staticState, MachineState nextState) throws Exception { assert(dynamicState.container != null); assert(dynamicState.currentAssignment != null); assert(dynamicState.container.areAllProcessesDead()); dynamicState.container.cleanUp(); staticState.localizer.releaseSlotFor(dynamicState.currentAssignment, staticState.port); DynamicState ret = dynamicState.withCurrentAssignment(null, null); if (nextState != null) { ret = ret.withState(nextState); } return ret; }