org.apache.flink.runtime.resourcemanager.slotmanager.SlotManagerBuilder Java Examples
The following examples show how to use
org.apache.flink.runtime.resourcemanager.slotmanager.SlotManagerBuilder.
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: 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 #2
Source File: KubernetesResourceManagerTest.java From flink with Apache License 2.0 | 6 votes |
void runTest(RunnableWithException testMethod) throws Exception { if (slotManager == null) { WorkerResourceSpec workerResourceSpec = KubernetesWorkerResourceSpecFactory.INSTANCE .createDefaultWorkerResourceSpec(flinkConfig); slotManager = SlotManagerBuilder.newBuilder() .setDefaultWorkerResourceSpec(workerResourceSpec) .build(); registerSlotProfile = SlotManagerImpl.generateDefaultSlotResourceProfile(workerResourceSpec, 1); } if (flinkKubeClient == null) { flinkKubeClient = KubernetesResourceManagerTest.this.flinkKubeClient; } resourceManager = createAndStartResourceManager(flinkConfig, slotManager, flinkKubeClient); try { testMethod.run(); } finally { resourceManager.close(); } }
Example #3
Source File: ResourceManagerTaskExecutorTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private StandaloneResourceManager createAndStartResourceManager(LeaderElectionService rmLeaderElectionService, FatalErrorHandler fatalErrorHandler) throws Exception { TestingHighAvailabilityServices highAvailabilityServices = new TestingHighAvailabilityServices(); HeartbeatServices heartbeatServices = new HeartbeatServices(1000L, HEARTBEAT_TIMEOUT); highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService); SlotManager slotManager = SlotManagerBuilder.newBuilder() .setScheduledExecutor(rpcService.getScheduledExecutor()) .build(); JobLeaderIdService jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); StandaloneResourceManager resourceManager = new StandaloneResourceManager( rpcService, ResourceManager.RESOURCE_MANAGER_NAME + UUID.randomUUID(), resourceManagerResourceID, highAvailabilityServices, heartbeatServices, slotManager, NoOpMetricRegistry.INSTANCE, jobLeaderIdService, new ClusterInformation("localhost", 1234), fatalErrorHandler, UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup()); resourceManager.start(); return resourceManager; }
Example #4
Source File: ResourceManagerTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private TestingResourceManager createAndStartResourceManager(HeartbeatServices heartbeatServices) throws Exception { final SlotManager slotManager = SlotManagerBuilder.newBuilder() .setScheduledExecutor(rpcService.getScheduledExecutor()) .build(); final JobLeaderIdService jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), TestingUtils.infiniteTime()); final TestingResourceManager resourceManager = new TestingResourceManager( rpcService, ResourceManager.RESOURCE_MANAGER_NAME + UUID.randomUUID(), resourceManagerResourceId, highAvailabilityServices, heartbeatServices, slotManager, NoOpMetricRegistry.INSTANCE, jobLeaderIdService, testingFatalErrorHandler, UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup()); resourceManager.start(); // first make the ResourceManager the leader resourceManagerId = ResourceManagerId.generate(); resourceManagerLeaderElectionService.isLeader(resourceManagerId.toUUID()).get(); return resourceManager; }
Example #5
Source File: ResourceManagerJobMasterTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private ResourceManager<?> createAndStartResourceManager() throws Exception { ResourceID rmResourceId = ResourceID.generate(); HeartbeatServices heartbeatServices = new HeartbeatServices(1000L, 1000L); JobLeaderIdService jobLeaderIdService = new JobLeaderIdService( haServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); final SlotManager slotManager = SlotManagerBuilder.newBuilder() .setScheduledExecutor(rpcService.getScheduledExecutor()) .build(); ResourceManager<?> resourceManager = new StandaloneResourceManager( rpcService, ResourceManager.RESOURCE_MANAGER_NAME, rmResourceId, haServices, heartbeatServices, slotManager, NoOpMetricRegistry.INSTANCE, jobLeaderIdService, new ClusterInformation("localhost", 1234), testingFatalErrorHandler, UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup()); resourceManager.start(); return resourceManager; }
Example #6
Source File: ResourceManagerTaskExecutorTest.java From flink with Apache License 2.0 | 5 votes |
private StandaloneResourceManager createAndStartResourceManager(LeaderElectionService rmLeaderElectionService, FatalErrorHandler fatalErrorHandler) throws Exception { TestingHighAvailabilityServices highAvailabilityServices = new TestingHighAvailabilityServices(); HeartbeatServices heartbeatServices = new HeartbeatServices(1000L, HEARTBEAT_TIMEOUT); highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService); SlotManager slotManager = SlotManagerBuilder.newBuilder() .setScheduledExecutor(rpcService.getScheduledExecutor()) .build(); JobLeaderIdService jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); StandaloneResourceManager resourceManager = new StandaloneResourceManager( rpcService, ResourceManager.RESOURCE_MANAGER_NAME + UUID.randomUUID(), resourceManagerResourceID, highAvailabilityServices, heartbeatServices, slotManager, NoOpMetricRegistry.INSTANCE, jobLeaderIdService, new ClusterInformation("localhost", 1234), fatalErrorHandler, UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup(), Time.minutes(5L)); resourceManager.start(); return resourceManager; }
Example #7
Source File: MockResourceManagerRuntimeServices.java From flink with Apache License 2.0 | 5 votes |
public MockResourceManagerRuntimeServices(RpcService rpcService, Time timeout) { this(rpcService, timeout, SlotManagerBuilder.newBuilder() .setScheduledExecutor(new ScheduledExecutorServiceAdapter(new DirectScheduledExecutorService())) .setTaskManagerRequestTimeout(Time.seconds(10)) .setSlotRequestTimeout(Time.seconds(10)) .setTaskManagerTimeout(Time.minutes(1)) .build()); }
Example #8
Source File: ResourceManagerTest.java From flink with Apache License 2.0 | 5 votes |
private TestingResourceManager createAndStartResourceManager(HeartbeatServices heartbeatServices) throws Exception { final SlotManager slotManager = SlotManagerBuilder.newBuilder() .setScheduledExecutor(rpcService.getScheduledExecutor()) .build(); final JobLeaderIdService jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), TestingUtils.infiniteTime()); final TestingResourceManager resourceManager = new TestingResourceManager( rpcService, ResourceManager.RESOURCE_MANAGER_NAME + UUID.randomUUID(), resourceManagerResourceId, highAvailabilityServices, heartbeatServices, slotManager, NoOpMetricRegistry.INSTANCE, jobLeaderIdService, testingFatalErrorHandler, UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup()); resourceManager.start(); // first make the ResourceManager the leader resourceManagerId = ResourceManagerId.generate(); resourceManagerLeaderElectionService.isLeader(resourceManagerId.toUUID()).get(); return resourceManager; }
Example #9
Source File: ResourceManagerJobMasterTest.java From flink with Apache License 2.0 | 5 votes |
private ResourceManager<?> createAndStartResourceManager() throws Exception { ResourceID rmResourceId = ResourceID.generate(); HeartbeatServices heartbeatServices = new HeartbeatServices(1000L, 1000L); JobLeaderIdService jobLeaderIdService = new JobLeaderIdService( haServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); final SlotManager slotManager = SlotManagerBuilder.newBuilder() .setScheduledExecutor(rpcService.getScheduledExecutor()) .build(); ResourceManager<?> resourceManager = new StandaloneResourceManager( rpcService, ResourceManager.RESOURCE_MANAGER_NAME, rmResourceId, haServices, heartbeatServices, slotManager, NoOpMetricRegistry.INSTANCE, jobLeaderIdService, new ClusterInformation("localhost", 1234), testingFatalErrorHandler, UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup(), Time.minutes(5L)); resourceManager.start(); return resourceManager; }
Example #10
Source File: YarnResourceManagerTest.java From flink with Apache License 2.0 | 5 votes |
Context(Configuration configuration, @Nullable SlotManager slotManager) throws Exception { workerResourceSpec = YarnWorkerResourceSpecFactory.INSTANCE.createDefaultWorkerResourceSpec(configuration); if (slotManager == null) { slotManager = SlotManagerBuilder.newBuilder() .setDefaultWorkerResourceSpec(workerResourceSpec) .build(); } rpcService = new TestingRpcService(); rmServices = new MockResourceManagerRuntimeServices(rpcService, TIMEOUT, slotManager); // resource manager rmResourceID = ResourceID.generate(); resourceManager = new TestingYarnResourceManager( rpcService, rmResourceID, configuration, env, rmServices.highAvailabilityServices, rmServices.heartbeatServices, rmServices.slotManager, rmServices.jobLeaderIdService, new ClusterInformation("localhost", 1234), testingFatalErrorHandler, null, UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup()); testingYarnAMRMClientAsync = resourceManager.testingYarnAMRMClientAsync; testingYarnNMClientAsync = resourceManager.testingYarnNMClientAsync; containerResource = resourceManager.getContainerResource(workerResourceSpec).get(); }
Example #11
Source File: ResourceManagerTaskExecutorTest.java From flink with Apache License 2.0 | 5 votes |
private StandaloneResourceManager createAndStartResourceManager(LeaderElectionService rmLeaderElectionService, FatalErrorHandler fatalErrorHandler) throws Exception { TestingHighAvailabilityServices highAvailabilityServices = new TestingHighAvailabilityServices(); HeartbeatServices heartbeatServices = new HeartbeatServices(1000L, HEARTBEAT_TIMEOUT); highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService); SlotManager slotManager = SlotManagerBuilder.newBuilder() .setScheduledExecutor(rpcService.getScheduledExecutor()) .build(); JobLeaderIdService jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); StandaloneResourceManager resourceManager = new StandaloneResourceManager( rpcService, resourceManagerResourceID, highAvailabilityServices, heartbeatServices, slotManager, NoOpResourceManagerPartitionTracker::get, jobLeaderIdService, new ClusterInformation("localhost", 1234), fatalErrorHandler, UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup(), Time.minutes(5L), RpcUtils.INF_TIMEOUT); resourceManager.start(); return resourceManager; }
Example #12
Source File: MockResourceManagerRuntimeServices.java From flink with Apache License 2.0 | 5 votes |
public MockResourceManagerRuntimeServices(RpcService rpcService, Time timeout) { this(rpcService, timeout, SlotManagerBuilder.newBuilder() .setScheduledExecutor(new ScheduledExecutorServiceAdapter(new DirectScheduledExecutorService())) .setTaskManagerRequestTimeout(Time.seconds(10)) .setSlotRequestTimeout(Time.seconds(10)) .setTaskManagerTimeout(Time.minutes(1)) .build()); }
Example #13
Source File: ResourceManagerTest.java From flink with Apache License 2.0 | 5 votes |
private TestingResourceManager createAndStartResourceManager(HeartbeatServices heartbeatServices) throws Exception { final SlotManager slotManager = SlotManagerBuilder.newBuilder() .setScheduledExecutor(rpcService.getScheduledExecutor()) .build(); final JobLeaderIdService jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), TestingUtils.infiniteTime()); final TestingResourceManager resourceManager = new TestingResourceManager( rpcService, resourceManagerResourceId, highAvailabilityServices, heartbeatServices, slotManager, NoOpResourceManagerPartitionTracker::get, jobLeaderIdService, testingFatalErrorHandler, UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup()); resourceManager.start(); // first make the ResourceManager the leader resourceManagerId = ResourceManagerId.generate(); resourceManagerLeaderElectionService.isLeader(resourceManagerId.toUUID()).get(); return resourceManager; }
Example #14
Source File: ResourceManagerJobMasterTest.java From flink with Apache License 2.0 | 5 votes |
private ResourceManager<?> createAndStartResourceManager() throws Exception { ResourceID rmResourceId = ResourceID.generate(); HeartbeatServices heartbeatServices = new HeartbeatServices(1000L, 1000L); JobLeaderIdService jobLeaderIdService = new JobLeaderIdService( haServices, rpcService.getScheduledExecutor(), Time.minutes(5L)); final SlotManager slotManager = SlotManagerBuilder.newBuilder() .setScheduledExecutor(rpcService.getScheduledExecutor()) .build(); ResourceManager<?> resourceManager = new StandaloneResourceManager( rpcService, rmResourceId, haServices, heartbeatServices, slotManager, NoOpResourceManagerPartitionTracker::get, jobLeaderIdService, new ClusterInformation("localhost", 1234), testingFatalErrorHandler, UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup(), Time.minutes(5L), RpcUtils.INF_TIMEOUT); resourceManager.start(); return resourceManager; }
Example #15
Source File: ResourceManagerPartitionLifecycleTest.java From flink with Apache License 2.0 | 5 votes |
private ResourceManagerGateway createAndStartResourceManager() throws Exception { final SlotManager slotManager = SlotManagerBuilder.newBuilder() .setScheduledExecutor(rpcService.getScheduledExecutor()) .build(); final JobLeaderIdService jobLeaderIdService = new JobLeaderIdService( highAvailabilityServices, rpcService.getScheduledExecutor(), TestingUtils.infiniteTime()); final TestingResourceManager resourceManager = new TestingResourceManager( rpcService, ResourceID.generate(), highAvailabilityServices, new HeartbeatServices(100000L, 1000000L), slotManager, ResourceManagerPartitionTrackerImpl::new, jobLeaderIdService, testingFatalErrorHandler, UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup()); resourceManager.start(); // first make the ResourceManager the leader resourceManagerLeaderElectionService.isLeader(ResourceManagerId.generate().toUUID()).get(); this.resourceManager = resourceManager; return resourceManager.getSelfGateway(ResourceManagerGateway.class); }