org.apache.flink.runtime.resourcemanager.JobLeaderIdService Java Examples
The following examples show how to use
org.apache.flink.runtime.resourcemanager.JobLeaderIdService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MesosResourceManagerTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
MockResourceManagerRuntimeServices() throws Exception { highAvailabilityServices = new TestingHighAvailabilityServices(); rmLeaderElectionService = new TestingLeaderElectionService(); highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService); heartbeatServices = new HeartbeatServices(5L, 5L); metricRegistry = mock(MetricRegistryImpl.class); slotManager = mock(SlotManager.class); slotManagerStarted = new CompletableFuture<>(); jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); doAnswer(new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { rmActions = invocation.getArgument(2); slotManagerStarted.complete(true); return null; } }).when(slotManager).start(any(ResourceManagerId.class), any(Executor.class), any(ResourceActions.class)); when(slotManager.registerSlotRequest(any(SlotRequest.class))).thenReturn(true); }
Example #2
Source File: MesosResourceManagerTest.java From flink with Apache License 2.0 | 6 votes |
MockResourceManagerRuntimeServices() throws Exception { highAvailabilityServices = new TestingHighAvailabilityServices(); rmLeaderElectionService = new TestingLeaderElectionService(); highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService); heartbeatServices = new HeartbeatServices(Integer.MAX_VALUE, Integer.MAX_VALUE); slotManager = mock(SlotManager.class); slotManagerStarted = new CompletableFuture<>(); jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); doAnswer(new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { rmActions = invocation.getArgument(2); slotManagerStarted.complete(true); return null; } }).when(slotManager).start(any(ResourceManagerId.class), any(Executor.class), any(ResourceActions.class)); when(slotManager.registerSlotRequest(any(SlotRequest.class))).thenReturn(true); }
Example #3
Source File: YarnResourceManagerTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
MockResourceManagerRuntimeServices() throws Exception { highAvailabilityServices = new TestingHighAvailabilityServices(); rmLeaderElectionService = new TestingLeaderElectionService(); highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService); heartbeatServices = new TestingHeartbeatServices(); metricRegistry = NoOpMetricRegistry.INSTANCE; slotManager = SlotManagerBuilder.newBuilder() .setScheduledExecutor(new ScheduledExecutorServiceAdapter(new DirectScheduledExecutorService())) .setTaskManagerRequestTimeout(Time.seconds(10)) .setSlotRequestTimeout(Time.seconds(10)) .setTaskManagerTimeout(Time.minutes(1)) .build(); jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); }
Example #4
Source File: MesosResourceManagerTest.java From flink with Apache License 2.0 | 6 votes |
MockResourceManagerRuntimeServices() throws Exception { highAvailabilityServices = new TestingHighAvailabilityServices(); rmLeaderElectionService = new TestingLeaderElectionService(); highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService); heartbeatServices = new HeartbeatServices(5L, 5L); metricRegistry = mock(MetricRegistryImpl.class); slotManager = mock(SlotManager.class); slotManagerStarted = new CompletableFuture<>(); jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); doAnswer(new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { rmActions = invocation.getArgument(2); slotManagerStarted.complete(true); return null; } }).when(slotManager).start(any(ResourceManagerId.class), any(Executor.class), any(ResourceActions.class)); when(slotManager.registerSlotRequest(any(SlotRequest.class))).thenReturn(true); }
Example #5
Source File: YarnResourceManagerTest.java From flink with Apache License 2.0 | 5 votes |
TestingYarnResourceManager( RpcService rpcService, String resourceManagerEndpointId, ResourceID resourceId, Configuration flinkConfig, Map<String, String> env, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, MetricRegistry metricRegistry, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, @Nullable String webInterfaceUrl, AMRMClientAsync<AMRMClient.ContainerRequest> mockResourceManagerClient, NMClient mockNMClient, JobManagerMetricGroup jobManagerMetricGroup) { super( rpcService, resourceManagerEndpointId, resourceId, flinkConfig, env, highAvailabilityServices, heartbeatServices, slotManager, metricRegistry, jobLeaderIdService, clusterInformation, fatalErrorHandler, webInterfaceUrl, jobManagerMetricGroup); this.mockNMClient = mockNMClient; this.mockResourceManagerClient = mockResourceManagerClient; }
Example #6
Source File: MockResourceManagerRuntimeServices.java From flink with Apache License 2.0 | 5 votes |
public MockResourceManagerRuntimeServices(RpcService rpcService, Time timeout, SlotManager slotManager) { this.rpcService = checkNotNull(rpcService); this.timeout = checkNotNull(timeout); this.slotManager = slotManager; highAvailabilityServices = new TestingHighAvailabilityServices(); rmLeaderElectionService = new TestingLeaderElectionService(); highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService); heartbeatServices = new TestingHeartbeatServices(); jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); }
Example #7
Source File: YarnResourceManagerTest.java From flink with Apache License 2.0 | 5 votes |
TestingYarnResourceManager( RpcService rpcService, ResourceID resourceId, Configuration flinkConfig, Map<String, String> env, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, @Nullable String webInterfaceUrl, ResourceManagerMetricGroup resourceManagerMetricGroup) { super( rpcService, resourceId, flinkConfig, env, highAvailabilityServices, heartbeatServices, slotManager, NoOpResourceManagerPartitionTracker::get, jobLeaderIdService, clusterInformation, fatalErrorHandler, webInterfaceUrl, resourceManagerMetricGroup); this.testingYarnNMClientAsync = new TestingYarnNMClientAsync(this); this.testingYarnAMRMClientAsync = new TestingYarnAMRMClientAsync(this); }
Example #8
Source File: MesosResourceManagerTest.java From flink with Apache License 2.0 | 5 votes |
public TestingMesosResourceManager( RpcService rpcService, String resourceManagerEndpointId, ResourceID resourceId, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, JobLeaderIdService jobLeaderIdService, FatalErrorHandler fatalErrorHandler, // Mesos specifics Configuration flinkConfig, MesosServices mesosServices, MesosConfiguration mesosConfig, MesosTaskManagerParameters taskManagerParameters, ContainerSpecification taskManagerContainerSpec, ResourceManagerMetricGroup resourceManagerMetricGroup) { super( rpcService, resourceId, highAvailabilityServices, heartbeatServices, slotManager, NoOpResourceManagerPartitionTracker::get, jobLeaderIdService, new ClusterInformation("localhost", 1234), fatalErrorHandler, flinkConfig, mesosServices, mesosConfig, taskManagerParameters, taskManagerContainerSpec, null, resourceManagerMetricGroup); }
Example #9
Source File: KubernetesResourceManagerTest.java From flink with Apache License 2.0 | 5 votes |
TestingKubernetesResourceManager( RpcService rpcService, ResourceID resourceId, Configuration flinkConfig, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, ResourceManagerMetricGroup resourceManagerMetricGroup, FlinkKubeClient flinkKubeClient, KubernetesResourceManagerConfiguration configuration) { super( rpcService, resourceId, flinkConfig, highAvailabilityServices, heartbeatServices, slotManager, NoOpResourceManagerPartitionTracker::get, jobLeaderIdService, clusterInformation, fatalErrorHandler, resourceManagerMetricGroup, flinkKubeClient, configuration ); }
Example #10
Source File: KubernetesResourceManager.java From flink with Apache License 2.0 | 5 votes |
public KubernetesResourceManager( RpcService rpcService, ResourceID resourceId, Configuration flinkConfig, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, ResourceManagerMetricGroup resourceManagerMetricGroup, FlinkKubeClient kubeClient, KubernetesResourceManagerConfiguration configuration) { super( flinkConfig, System.getenv(), rpcService, resourceId, highAvailabilityServices, heartbeatServices, slotManager, clusterPartitionTrackerFactory, jobLeaderIdService, clusterInformation, fatalErrorHandler, resourceManagerMetricGroup); this.clusterId = configuration.getClusterId(); this.kubeClient = kubeClient; this.configuration = configuration; this.podWorkerResources = new HashMap<>(); }
Example #11
Source File: MockResourceManagerRuntimeServices.java From flink with Apache License 2.0 | 5 votes |
public MockResourceManagerRuntimeServices(RpcService rpcService, Time timeout, SlotManager slotManager) { this.rpcService = checkNotNull(rpcService); this.timeout = checkNotNull(timeout); this.slotManager = slotManager; highAvailabilityServices = new TestingHighAvailabilityServices(); rmLeaderElectionService = new TestingLeaderElectionService(); highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService); heartbeatServices = new TestingHeartbeatServices(); metricRegistry = NoOpMetricRegistry.INSTANCE; jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); }
Example #12
Source File: MesosResourceManagerTest.java From flink with Apache License 2.0 | 5 votes |
public TestingMesosResourceManager( RpcService rpcService, String resourceManagerEndpointId, ResourceID resourceId, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, MetricRegistry metricRegistry, JobLeaderIdService jobLeaderIdService, FatalErrorHandler fatalErrorHandler, // Mesos specifics Configuration flinkConfig, MesosServices mesosServices, MesosConfiguration mesosConfig, MesosTaskManagerParameters taskManagerParameters, ContainerSpecification taskManagerContainerSpec, JobManagerMetricGroup jobManagerMetricGroup) { super( rpcService, resourceManagerEndpointId, resourceId, highAvailabilityServices, heartbeatServices, slotManager, metricRegistry, jobLeaderIdService, new ClusterInformation("localhost", 1234), fatalErrorHandler, flinkConfig, mesosServices, mesosConfig, taskManagerParameters, taskManagerContainerSpec, null, jobManagerMetricGroup); }
Example #13
Source File: YarnResourceManagerTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
TestingYarnResourceManager( RpcService rpcService, String resourceManagerEndpointId, ResourceID resourceId, Configuration flinkConfig, Map<String, String> env, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, MetricRegistry metricRegistry, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, @Nullable String webInterfaceUrl, AMRMClientAsync<AMRMClient.ContainerRequest> mockResourceManagerClient, NMClient mockNMClient, JobManagerMetricGroup jobManagerMetricGroup) { super( rpcService, resourceManagerEndpointId, resourceId, flinkConfig, env, highAvailabilityServices, heartbeatServices, slotManager, metricRegistry, jobLeaderIdService, clusterInformation, fatalErrorHandler, webInterfaceUrl, jobManagerMetricGroup); this.mockNMClient = mockNMClient; this.mockResourceManagerClient = mockResourceManagerClient; }
Example #14
Source File: MesosResourceManagerTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public TestingMesosResourceManager( RpcService rpcService, String resourceManagerEndpointId, ResourceID resourceId, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, MetricRegistry metricRegistry, JobLeaderIdService jobLeaderIdService, FatalErrorHandler fatalErrorHandler, // Mesos specifics Configuration flinkConfig, MesosServices mesosServices, MesosConfiguration mesosConfig, MesosTaskManagerParameters taskManagerParameters, ContainerSpecification taskManagerContainerSpec, JobManagerMetricGroup jobManagerMetricGroup) { super( rpcService, resourceManagerEndpointId, resourceId, highAvailabilityServices, heartbeatServices, slotManager, metricRegistry, jobLeaderIdService, new ClusterInformation("localhost", 1234), fatalErrorHandler, flinkConfig, mesosServices, mesosConfig, taskManagerParameters, taskManagerContainerSpec, null, jobManagerMetricGroup); }
Example #15
Source File: MesosResourceManager.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public MesosResourceManager( // base class RpcService rpcService, String resourceManagerEndpointId, ResourceID resourceId, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, MetricRegistry metricRegistry, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, // Mesos specifics Configuration flinkConfig, MesosServices mesosServices, MesosConfiguration mesosConfig, MesosTaskManagerParameters taskManagerParameters, ContainerSpecification taskManagerContainerSpec, @Nullable String webUiUrl, JobManagerMetricGroup jobManagerMetricGroup) { super( rpcService, resourceManagerEndpointId, resourceId, highAvailabilityServices, heartbeatServices, slotManager, metricRegistry, jobLeaderIdService, clusterInformation, fatalErrorHandler, jobManagerMetricGroup); this.mesosServices = Preconditions.checkNotNull(mesosServices); this.actorSystem = Preconditions.checkNotNull(mesosServices.getLocalActorSystem()); this.flinkConfig = Preconditions.checkNotNull(flinkConfig); this.mesosConfig = Preconditions.checkNotNull(mesosConfig); this.artifactServer = Preconditions.checkNotNull(mesosServices.getArtifactServer()); this.taskManagerParameters = Preconditions.checkNotNull(taskManagerParameters); this.taskManagerContainerSpec = Preconditions.checkNotNull(taskManagerContainerSpec); this.webUiUrl = webUiUrl; this.workersInNew = new HashMap<>(8); this.workersInLaunch = new HashMap<>(8); this.workersBeingReturned = new HashMap<>(8); final ContaineredTaskManagerParameters containeredTaskManagerParameters = taskManagerParameters.containeredParameters(); this.slotsPerWorker = createSlotsPerWorker(containeredTaskManagerParameters.numSlots()); }
Example #16
Source File: YarnResourceManager.java From flink with Apache License 2.0 | 4 votes |
public YarnResourceManager( RpcService rpcService, String resourceManagerEndpointId, ResourceID resourceId, Configuration flinkConfig, Map<String, String> env, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, MetricRegistry metricRegistry, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, @Nullable String webInterfaceUrl, JobManagerMetricGroup jobManagerMetricGroup) { super( rpcService, resourceManagerEndpointId, resourceId, highAvailabilityServices, heartbeatServices, slotManager, metricRegistry, jobLeaderIdService, clusterInformation, fatalErrorHandler, jobManagerMetricGroup); this.flinkConfig = flinkConfig; this.yarnConfig = new YarnConfiguration(); this.env = env; this.workerNodeMap = new ConcurrentHashMap<>(); final int yarnHeartbeatIntervalMS = flinkConfig.getInteger( YarnConfigOptions.HEARTBEAT_DELAY_SECONDS) * 1000; final long yarnExpiryIntervalMS = yarnConfig.getLong( YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS, YarnConfiguration.DEFAULT_RM_AM_EXPIRY_INTERVAL_MS); if (yarnHeartbeatIntervalMS >= yarnExpiryIntervalMS) { log.warn("The heartbeat interval of the Flink Application master ({}) is greater " + "than YARN's expiry interval ({}). The application is likely to be killed by YARN.", yarnHeartbeatIntervalMS, yarnExpiryIntervalMS); } yarnHeartbeatIntervalMillis = yarnHeartbeatIntervalMS; containerRequestHeartbeatIntervalMillis = flinkConfig.getInteger(YarnConfigOptions.CONTAINER_REQUEST_HEARTBEAT_INTERVAL_MILLISECONDS); numPendingContainerRequests = 0; this.webInterfaceUrl = webInterfaceUrl; this.numberOfTaskSlots = flinkConfig.getInteger(TaskManagerOptions.NUM_TASK_SLOTS); this.defaultTaskManagerMemoryMB = ConfigurationUtils.getTaskManagerHeapMemory(flinkConfig).getMebiBytes(); this.defaultCpus = flinkConfig.getInteger(YarnConfigOptions.VCORES, numberOfTaskSlots); this.resource = Resource.newInstance(defaultTaskManagerMemoryMB, defaultCpus); this.slotsPerWorker = createWorkerSlotProfiles(flinkConfig); }
Example #17
Source File: MesosResourceManager.java From flink with Apache License 2.0 | 4 votes |
public MesosResourceManager( // base class RpcService rpcService, ResourceID resourceId, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, // Mesos specifics Configuration flinkConfig, MesosServices mesosServices, MesosConfiguration mesosConfig, MesosTaskManagerParameters taskManagerParameters, ContainerSpecification taskManagerContainerSpec, @Nullable String webUiUrl, ResourceManagerMetricGroup resourceManagerMetricGroup) { super( rpcService, resourceId, highAvailabilityServices, heartbeatServices, slotManager, clusterPartitionTrackerFactory, jobLeaderIdService, clusterInformation, fatalErrorHandler, resourceManagerMetricGroup, AkkaUtils.getTimeoutAsTime(flinkConfig)); this.mesosServices = Preconditions.checkNotNull(mesosServices); this.actorSystem = Preconditions.checkNotNull(mesosServices.getLocalActorSystem()); this.flinkConfig = Preconditions.checkNotNull(flinkConfig); this.mesosConfig = Preconditions.checkNotNull(mesosConfig); this.artifactServer = Preconditions.checkNotNull(mesosServices.getArtifactServer()); this.taskManagerParameters = Preconditions.checkNotNull(taskManagerParameters); this.taskManagerContainerSpec = Preconditions.checkNotNull(taskManagerContainerSpec); this.webUiUrl = webUiUrl; this.workersInNew = new HashMap<>(8); this.workersInLaunch = new HashMap<>(8); this.workersBeingReturned = new HashMap<>(8); }
Example #18
Source File: MesosResourceManager.java From flink with Apache License 2.0 | 4 votes |
public MesosResourceManager( // base class RpcService rpcService, String resourceManagerEndpointId, ResourceID resourceId, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, MetricRegistry metricRegistry, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, // Mesos specifics Configuration flinkConfig, MesosServices mesosServices, MesosConfiguration mesosConfig, MesosTaskManagerParameters taskManagerParameters, ContainerSpecification taskManagerContainerSpec, @Nullable String webUiUrl, JobManagerMetricGroup jobManagerMetricGroup) { super( rpcService, resourceManagerEndpointId, resourceId, highAvailabilityServices, heartbeatServices, slotManager, metricRegistry, jobLeaderIdService, clusterInformation, fatalErrorHandler, jobManagerMetricGroup); this.mesosServices = Preconditions.checkNotNull(mesosServices); this.actorSystem = Preconditions.checkNotNull(mesosServices.getLocalActorSystem()); this.flinkConfig = Preconditions.checkNotNull(flinkConfig); this.mesosConfig = Preconditions.checkNotNull(mesosConfig); this.artifactServer = Preconditions.checkNotNull(mesosServices.getArtifactServer()); this.taskManagerParameters = Preconditions.checkNotNull(taskManagerParameters); this.taskManagerContainerSpec = Preconditions.checkNotNull(taskManagerContainerSpec); this.webUiUrl = webUiUrl; this.workersInNew = new HashMap<>(8); this.workersInLaunch = new HashMap<>(8); this.workersBeingReturned = new HashMap<>(8); this.slotsPerWorker = createWorkerSlotProfiles(flinkConfig); }
Example #19
Source File: YarnResourceManager.java From flink with Apache License 2.0 | 4 votes |
public YarnResourceManager( RpcService rpcService, ResourceID resourceId, Configuration flinkConfig, Map<String, String> env, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, @Nullable String webInterfaceUrl, ResourceManagerMetricGroup resourceManagerMetricGroup) { super( flinkConfig, env, rpcService, resourceId, highAvailabilityServices, heartbeatServices, slotManager, clusterPartitionTrackerFactory, jobLeaderIdService, clusterInformation, fatalErrorHandler, resourceManagerMetricGroup); this.yarnConfig = new YarnConfiguration(); this.workerNodeMap = new ConcurrentHashMap<>(); final int yarnHeartbeatIntervalMS = flinkConfig.getInteger( YarnConfigOptions.HEARTBEAT_DELAY_SECONDS) * 1000; final long yarnExpiryIntervalMS = yarnConfig.getLong( YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS, YarnConfiguration.DEFAULT_RM_AM_EXPIRY_INTERVAL_MS); if (yarnHeartbeatIntervalMS >= yarnExpiryIntervalMS) { log.warn("The heartbeat interval of the Flink Application master ({}) is greater " + "than YARN's expiry interval ({}). The application is likely to be killed by YARN.", yarnHeartbeatIntervalMS, yarnExpiryIntervalMS); } yarnHeartbeatIntervalMillis = yarnHeartbeatIntervalMS; containerRequestHeartbeatIntervalMillis = flinkConfig.getInteger(YarnConfigOptions.CONTAINER_REQUEST_HEARTBEAT_INTERVAL_MILLISECONDS); this.webInterfaceUrl = webInterfaceUrl; this.workerSpecContainerResourceAdapter = new WorkerSpecContainerResourceAdapter( flinkConfig, yarnConfig.getInt( YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB), yarnConfig.getInt( YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES, YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES), yarnConfig.getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB), yarnConfig.getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES), ExternalResourceUtils.getExternalResources(flinkConfig, YarnConfigOptions.EXTERNAL_RESOURCE_YARN_CONFIG_KEY_SUFFIX)); this.registerApplicationMasterResponseReflector = new RegisterApplicationMasterResponseReflector(log); this.matchingStrategy = flinkConfig.getBoolean(YarnConfigOptionsInternal.MATCH_CONTAINER_VCORES) ? WorkerSpecContainerResourceAdapter.MatchingStrategy.MATCH_VCORE : WorkerSpecContainerResourceAdapter.MatchingStrategy.IGNORE_VCORE; }
Example #20
Source File: YarnResourceManager.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public YarnResourceManager( RpcService rpcService, String resourceManagerEndpointId, ResourceID resourceId, Configuration flinkConfig, Map<String, String> env, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, SlotManager slotManager, MetricRegistry metricRegistry, JobLeaderIdService jobLeaderIdService, ClusterInformation clusterInformation, FatalErrorHandler fatalErrorHandler, @Nullable String webInterfaceUrl, JobManagerMetricGroup jobManagerMetricGroup) { super( rpcService, resourceManagerEndpointId, resourceId, highAvailabilityServices, heartbeatServices, slotManager, metricRegistry, jobLeaderIdService, clusterInformation, fatalErrorHandler, jobManagerMetricGroup); this.flinkConfig = flinkConfig; this.yarnConfig = new YarnConfiguration(); this.env = env; this.workerNodeMap = new ConcurrentHashMap<>(); final int yarnHeartbeatIntervalMS = flinkConfig.getInteger( YarnConfigOptions.HEARTBEAT_DELAY_SECONDS) * 1000; final long yarnExpiryIntervalMS = yarnConfig.getLong( YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS, YarnConfiguration.DEFAULT_RM_AM_EXPIRY_INTERVAL_MS); if (yarnHeartbeatIntervalMS >= yarnExpiryIntervalMS) { log.warn("The heartbeat interval of the Flink Application master ({}) is greater " + "than YARN's expiry interval ({}). The application is likely to be killed by YARN.", yarnHeartbeatIntervalMS, yarnExpiryIntervalMS); } yarnHeartbeatIntervalMillis = yarnHeartbeatIntervalMS; containerRequestHeartbeatIntervalMillis = flinkConfig.getInteger(YarnConfigOptions.CONTAINER_REQUEST_HEARTBEAT_INTERVAL_MILLISECONDS); numPendingContainerRequests = 0; this.webInterfaceUrl = webInterfaceUrl; this.numberOfTaskSlots = flinkConfig.getInteger(TaskManagerOptions.NUM_TASK_SLOTS); this.defaultTaskManagerMemoryMB = ConfigurationUtils.getTaskManagerHeapMemory(flinkConfig).getMebiBytes(); this.defaultCpus = flinkConfig.getInteger(YarnConfigOptions.VCORES, numberOfTaskSlots); this.resource = Resource.newInstance(defaultTaskManagerMemoryMB, defaultCpus); this.slotsPerWorker = createSlotsPerWorker(numberOfTaskSlots); }