private void onRuntimeError(final Throwable throwable) { // SHUTDOWN YARN try { this.reefEventHandlers.close(); this.resourceManager.unregisterApplicationMaster( FinalApplicationStatus.FAILED, throwable.getMessage(), null); } catch (final Exception e) { LOG.log(Level.WARNING, "Error shutting down YARN application", e); } finally { this.resourceManager.stop(); } final RuntimeStatusProto.Builder runtimeStatusBuilder = RuntimeStatusProto.newBuilder() .setState(ReefServiceProtos.State.FAILED) .setName(RUNTIME_NAME); final Encoder<Throwable> codec = new ObjectSerializableCodec<>(); runtimeStatusBuilder.setError(ReefServiceProtos.RuntimeErrorProto.newBuilder() .setName(RUNTIME_NAME) .setMessage(throwable.getMessage()) .setException(ByteString.copyFrom(codec.encode(throwable))) .build()) .build(); this.reefEventHandlers.onRuntimeStatus(runtimeStatusBuilder.build()); }
@Override public void onShutdownRequest() { this.reefEventHandlers.onRuntimeStatus(RuntimeStatusProto.newBuilder() .setName(RUNTIME_NAME).setState(ReefServiceProtos.State.DONE).build()); this.driverStatusManager.onError(new Exception("Shutdown requested by YARN.")); }
private void sendRuntimeStatus() { final DriverRuntimeProtocol.RuntimeStatusProto msg = DriverRuntimeProtocol.RuntimeStatusProto.newBuilder() .setName("LOCAL") .setState(ReefServiceProtos.State.RUNNING) .setOutstandingContainerRequests(this.requestQueue.getNumberOfOutstandingRequests()) .addAllContainerAllocation(this.theContainers.getAllocatedContainerIDs()) .build(); LOG.log(Level.INFO, "Allocated: {0}, Outstanding requests: {1}", new Object[]{msg.getContainerAllocationCount(), msg.getOutstandingContainerRequests()}); this.runtimeStatusHandlerEventHandler.onNext(msg); }
/** * Update the driver with my current status */ private void updateRuntimeStatus() { final DriverRuntimeProtocol.RuntimeStatusProto.Builder builder = DriverRuntimeProtocol.RuntimeStatusProto.newBuilder() .setName(RUNTIME_NAME) .setState(ReefServiceProtos.State.RUNNING) .setOutstandingContainerRequests(this.containerRequestCounter.get()); for (final String allocatedContainerId : this.containers.getContainerIds()) { builder.addContainerAllocation(allocatedContainerId); } this.reefEventHandlers.onRuntimeStatus(builder.build()); }