@Override public CompletableFuture<Void> postStop() { return stopSupportingActorsAsync().thenCompose((ignored) -> super.postStop()); }
@Nullable String webInterfaceUrl, JobManagerMetricGroup jobManagerMetricGroup) throws Exception { final ResourceManagerRuntimeServicesConfiguration rmServicesConfiguration = ResourceManagerRuntimeServicesConfiguration.fromConfiguration(configuration); final ResourceManagerRuntimeServices rmRuntimeServices = ResourceManagerRuntimeServices.fromConfiguration( rmServicesConfiguration, highAvailabilityServices, highAvailabilityServices, heartbeatServices, rmRuntimeServices.getSlotManager(), metricRegistry, rmRuntimeServices.getJobLeaderIdService(), clusterInformation, fatalErrorHandler,
MockResourceManagerRuntimeServices() throws Exception { scheduledExecutor = mock(ScheduledExecutor.class); highAvailabilityServices = new TestingHighAvailabilityServices(); rmLeaderElectionService = new TestingLeaderElectionService(); highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService); heartbeatServices = new TestingHeartbeatServices(5L, 5L, scheduledExecutor); metricRegistry = NoOpMetricRegistry.INSTANCE; slotManager = new SlotManager( new ScheduledExecutorServiceAdapter(new DirectScheduledExecutorService()), Time.seconds(10), Time.seconds(10), Time.minutes(1)); jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); }
rmServices.slotManager.registerSlotRequest( new SlotRequest(new JobID(), new AllocationID(), resourceProfile1, taskHost)); return null; }); .registerTaskExecutor( taskHost, taskManagerResourceId, assertThat(response, instanceOf(TaskExecutorRegistrationSuccess.class)); final TaskExecutorRegistrationSuccess success = (TaskExecutorRegistrationSuccess) response; return rmGateway.sendSlotReport( taskManagerResourceId, success.getRegistrationId(), }) .handleAsync( (Acknowledge ignored, Throwable throwable) -> rmServices.slotManager.getNumberRegisteredSlots(), resourceManager.getMainThreadExecutorForTesting()); rmServices.slotManager.unregisterTaskManagersAndReleaseResources(); return null; }); assertThat(rmServices.slotManager.getNumberRegisteredSlots(), Matchers.equalTo(0)); assertThat(resourceManager.getNumberOfRegisteredTaskManagers().get(), Matchers.equalTo(0)); }};
runTest(() -> { CompletableFuture<?> registerSlotRequestFuture = resourceManager.runInMainThread(() -> { rmServices.slotManager.registerSlotRequest( new SlotRequest(new JobID(), new AllocationID(), resourceProfile1, taskHost)); return null; });
@Override public CompletableFuture<Void> closeAsync() { synchronized (lock) { resourceManager.shutDown(); return resourceManager.getTerminationFuture(); } }
@Override public void run() { listenerJobLeaderIdActions.notifyJobTimeout(jobId, newTimeoutId); } }, jobTimeout.toMilliseconds(), TimeUnit.MILLISECONDS);
/** * Stop the service. * * @throws Exception which is thrown in case a retrieval service cannot be stopped properly */ public void stop() throws Exception { clear(); this.jobLeaderIdActions = null; }
@Override public void notifyLeaderAddress(final String leaderAddress, final UUID leaderSessionID) { runAsync( () -> notifyOfNewResourceManagerLeader( leaderAddress, ResourceManagerId.fromUuidOrNull(leaderSessionID))); }
/** * Generates a new random ResourceManagerId. */ public static ResourceManagerId generate() { return new ResourceManagerId(); }
@Nullable String webInterfaceUrl, JobManagerMetricGroup jobManagerMetricGroup) throws Exception { final ResourceManagerRuntimeServicesConfiguration rmServicesConfiguration = ResourceManagerRuntimeServicesConfiguration.fromConfiguration(configuration); final ResourceManagerRuntimeServices rmRuntimeServices = ResourceManagerRuntimeServices.fromConfiguration( rmServicesConfiguration, highAvailabilityServices, highAvailabilityServices, heartbeatServices, rmRuntimeServices.getSlotManager(), metricRegistry, rmRuntimeServices.getJobLeaderIdService(), clusterInformation, fatalErrorHandler,
@Override public CompletableFuture<Void> closeAsync() { synchronized (lock) { resourceManager.shutDown(); return resourceManager.getTerminationFuture(); } }
@Override public void run() { listenerJobLeaderIdActions.notifyJobTimeout(jobId, newTimeoutId); } }, jobTimeout.toMilliseconds(), TimeUnit.MILLISECONDS);
/** * Stop the service. * * @throws Exception which is thrown in case a retrieval service cannot be stopped properly */ public void stop() throws Exception { clear(); this.jobLeaderIdActions = null; }
@Override public void notifyLeaderAddress(final String leaderAddress, final UUID leaderSessionID) { runAsync( () -> notifyOfNewResourceManagerLeader( leaderAddress, ResourceManagerId.fromUuidOrNull(leaderSessionID))); }
@Override public CompletableFuture<Void> postStop() { // shut down all components Throwable firstException = null; if (resourceManagerClient != null) { try { resourceManagerClient.stop(); } catch (Throwable t) { firstException = t; } } if (nodeManagerClient != null) { try { nodeManagerClient.stop(); } catch (Throwable t) { firstException = ExceptionUtils.firstOrSuppressed(t, firstException); } } final CompletableFuture<Void> terminationFuture = super.postStop(); if (firstException != null) { return FutureUtils.completedExceptionally(new FlinkException("Error while shutting down YARN resource manager", firstException)); } else { return terminationFuture; } }
/** * Creates a ResourceManagerId that corresponds to the given UUID. */ public static ResourceManagerId fromUuid(UUID uuid) { return new ResourceManagerId(uuid); }
@Override public void run() { listenerJobLeaderIdActions.notifyJobTimeout(jobId, newTimeoutId); } }, jobTimeout.toMilliseconds(), TimeUnit.MILLISECONDS);
@Override public void notifyLeaderAddress(final String leaderAddress, final UUID leaderSessionID) { runAsync( () -> notifyOfNewResourceManagerLeader( leaderAddress, ResourceManagerId.fromUuidOrNull(leaderSessionID))); }
@Override public void run() { listenerJobLeaderIdActions.notifyJobTimeout(jobId, newTimeoutId); } }, jobTimeout.toMilliseconds(), TimeUnit.MILLISECONDS);