/** * Change the state of the Resource Manager to be RUNNING. */ public synchronized void setRunning() { this.setState(State.RUNNING); }
@Override public void onNext(final RuntimeStatusEvent runtimeStatusEvent) { final State newState = runtimeStatusEvent.getState(); LOG.log(Level.FINEST, "Runtime status: {0}", runtimeStatusEvent); synchronized(this) { this.outstandingContainerRequests = runtimeStatusEvent.getOutstandingContainerRequests().orElse(0); this.containerAllocationCount = runtimeStatusEvent.getContainerAllocationList().size(); this.setState(newState); } switch (newState) { case FAILED: this.onRMFailure(runtimeStatusEvent); break; case DONE: this.onRMDone(runtimeStatusEvent); break; case RUNNING: this.onRMRunning(runtimeStatusEvent); break; case INIT: case SUSPEND: case KILLED: break; default: throw new RuntimeException("Unknown state: " + newState); } }
/** * Driver is idle if, regardless of status, it has no evaluators allocated * and no pending container requests. This method is used in the DriverIdleManager. * If all DriverIdlenessSource components are idle, DriverIdleManager will initiate Driver shutdown. * @return idle, if there are no outstanding requests or allocations. Not idle otherwise. */ @Override public synchronized IdleMessage getIdleStatus() { if (this.isIdle()) { return IDLE_MESSAGE; } final String message = String.format( "There are %d outstanding container requests and %d allocated containers", this.outstandingContainerRequests, this.containerAllocationCount); return new IdleMessage(COMPONENT_NAME, message, false); }
this.evaluatorResourceManagerErrorHandler); this.resourceManagerStatus.setRunning(); this.driverStatusManager.onRunning();
private void onRMRunning(final RuntimeStatusEvent runtimeStatusEvent) { assert runtimeStatusEvent.getState() == State.RUNNING; if (this.isIdle()) { this.driverIdleManager.get().onPotentiallyIdle(IDLE_MESSAGE); } }