@Override protected CompletableFuture<Void> clearStateAsync() { schedulerDriver.stop(true); workersInNew.clear(); workersInLaunch.clear(); workersBeingReturned.clear(); return stopSupportingActorsAsync(); }
@Override protected void internalDeregisterApplication( ApplicationStatus finalStatus, @Nullable String diagnostics) throws ResourceManagerException { LOG.info("Shutting down and unregistering as a Mesos framework."); Exception exception = null; try { // unregister the framework, which implicitly removes all tasks. schedulerDriver.stop(false); } catch (Exception ex) { exception = new Exception("Could not unregister the Mesos framework.", ex); } try { workerStore.stop(true); } catch (Exception ex) { exception = ExceptionUtils.firstOrSuppressed( new Exception("Could not stop the Mesos worker store.", ex), exception); } if (exception != null) { throw new ResourceManagerException("Could not properly shut down the Mesos application.", exception); } }
@EventListener public void onTearDownFrameworkEvent(TearDownFrameworkEvent event) { driver.get().stop(); logger.info("Driver stopped"); driver.set(null); }
public synchronized void stop() { try { SUPERVISOR_LOCK.lock(); if (driver != null) { LOGGER.info("Stopping Mesos driver."); driver.stop(); } else { LOGGER.warning("Unable to stop Mesos driver: driver is null."); } running = false; } finally { SUPERVISOR_LOCK.unlock(); } }
@Override public synchronized void terminate() throws IOException { try { LOG.info("Stopping MesosScheduler"); driver.stop(); } catch (Exception e) { LOG.error("Failed to stop Mesos scheduler", e); } taskScheduler.terminate(); }
public void onStop() { this.mesosMaster.stop(); try { this.schedulerDriverEStage.close(); } catch (final Exception e) { throw new RuntimeException(e); } }
/** * Destroys the framework. */ private void destroyFramework() { // Wipe all data from ZK. This includes the framework ID, which is used to detect across // restarts that the framework has been destroyed. LOGGER.info("Deleting all persisted data..."); try { PersisterUtils.clearAllData(persister); } catch (PersisterException e) { throw new IllegalStateException("Failed to delete all persister data", e); } LOGGER.info("Tearing down framework..."); // Stop the SchedulerDriver thread: // - failover==false: Tells Mesos to teardown the framework. // - This call will cause FrameworkRunner's SchedulerDriver.run() call to return DRIVER_STOPPED. Driver.getInstance().stop(false); LOGGER.info("### UNINSTALL IS COMPLETE! ###"); LOGGER.info("Scheduler should be cleaned up shortly..."); // Notify the client that deregistration has completed, following them giving us an UNINSTALLED // response. They can then set their "deploy" plan to Complete, which will in turn let Cosmos // know that this scheduler process can be pruned from Marathon. mesosEventClient.unregistered(); } }
@Test public void testStatusUninstalled() throws Exception { when(mockMesosEventClient.getClientStatus()).thenReturn(ClientStatusResponse.readyToRemove()); processor.setOfferQueueSize(0).start(); // unlimited queue size sendOffers(1, OFFERS_PER_THREAD); // Not all offers were processed because the deregistered bit was set in the process of teardown. // All offers should have been declined with a short interval (not ready, come back soon): verify(mockSchedulerDriver, atLeast(1)).stop(false); verify(mockMesosEventClient, atLeast(1)).unregistered(); verify(mockPersister, atLeast(1)).recursiveDelete("/"); verify(mockMesosEventClient, never()).offers(any()); verify(mockMesosEventClient, never()).getUnexpectedResources(any()); }
private void onRuntimeError(final Throwable throwable) { this.mesosMaster.stop(); try { this.schedulerDriverEStage.close(); } catch (final Exception e) { throw new RuntimeException(e); } final RuntimeStatusEventImpl.Builder runtimeStatusBuilder = RuntimeStatusEventImpl.newBuilder() .setState(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()); this.reefEventHandlers.onRuntimeStatus(runtimeStatusBuilder.build()); }
/** * 停止运行. */ public void stop() { restfulService.stop(); taskLaunchScheduledService.stopAsync(); cloudJobConfigurationListener.stop(); statisticManager.shutdown(); producerManager.shutdown(); schedulerDriver.stop(true); facadeService.stop(); if (env.getFrameworkConfiguration().isEnabledReconcile()) { reconcileService.stopAsync(); } } }