org.apache.flink.runtime.leaderelection.TestingLeaderElectionService Java Examples

The following examples show how to use org.apache.flink.runtime.leaderelection.TestingLeaderElectionService. 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 vote down vote up
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: DispatcherTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
	final JobVertex testVertex = new JobVertex("testVertex");
	testVertex.setInvokableClass(NoOpInvokable.class);
	jobGraph = new JobGraph(TEST_JOB_ID, "testJob", testVertex);

	heartbeatServices = new HeartbeatServices(1000L, 10000L);

	jobMasterLeaderElectionService = new TestingLeaderElectionService();

	haServices = new TestingHighAvailabilityServices();
	haServices.setJobMasterLeaderElectionService(TEST_JOB_ID, jobMasterLeaderElectionService);
	haServices.setCheckpointRecoveryFactory(new StandaloneCheckpointRecoveryFactory());
	haServices.setResourceManagerLeaderRetriever(new SettableLeaderRetrievalService());

	configuration = new Configuration();

	configuration.setString(
		BlobServerOptions.STORAGE_DIRECTORY,
		temporaryFolder.newFolder().getAbsolutePath());

	createdJobManagerRunnerLatch = new CountDownLatch(2);
	blobServer = new BlobServer(configuration, new VoidBlobStore());
}
 
Example #3
Source File: DefaultDispatcherRunnerITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() {
	dispatcherRunnerFactory = DefaultDispatcherRunnerFactory.createSessionRunner(SessionDispatcherFactory.INSTANCE);
	jobGraph = createJobGraph();
	dispatcherLeaderElectionService = new TestingLeaderElectionService();
	fatalErrorHandler = new TestingFatalErrorHandler();
	jobGraphStore = TestingJobGraphStore.newBuilder().build();

	partialDispatcherServices = new PartialDispatcherServices(
		new Configuration(),
		new TestingHighAvailabilityServicesBuilder().build(),
		CompletableFuture::new,
		blobServerResource.getBlobServer(),
		new TestingHeartbeatServices(),
		UnregisteredMetricGroups::createUnregisteredJobManagerMetricGroup,
		new MemoryArchivedExecutionGraphStore(),
		fatalErrorHandler,
		VoidHistoryServerArchivist.INSTANCE,
		null);
}
 
Example #4
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
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 #5
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
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 #6
Source File: ResourceManagerTaskExecutorTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	rpcService = new TestingRpcService();

	createAndRegisterTaskExecutorGateway();
	taskExecutorResourceID = ResourceID.generate();
	resourceManagerResourceID = ResourceID.generate();
	testingFatalErrorHandler = new TestingFatalErrorHandler();
	TestingLeaderElectionService rmLeaderElectionService = new TestingLeaderElectionService();
	resourceManager = createAndStartResourceManager(rmLeaderElectionService, testingFatalErrorHandler);
	rmGateway = resourceManager.getSelfGateway(ResourceManagerGateway.class);
	wronglyFencedGateway = rpcService.connect(resourceManager.getAddress(), ResourceManagerId.generate(), ResourceManagerGateway.class)
		.get(TIMEOUT.toMilliseconds(), TimeUnit.MILLISECONDS);

	grantLeadership(rmLeaderElectionService).get(TIMEOUT.toMilliseconds(), TimeUnit.MILLISECONDS);
}
 
Example #7
Source File: ResourceManagerTaskExecutorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	rpcService = new TestingRpcService();

	createAndRegisterTaskExecutorGateway();
	taskExecutorResourceID = ResourceID.generate();
	resourceManagerResourceID = ResourceID.generate();
	testingFatalErrorHandler = new TestingFatalErrorHandler();
	TestingLeaderElectionService rmLeaderElectionService = new TestingLeaderElectionService();
	resourceManager = createAndStartResourceManager(rmLeaderElectionService, testingFatalErrorHandler);
	rmGateway = resourceManager.getSelfGateway(ResourceManagerGateway.class);
	wronglyFencedGateway = rpcService.connect(resourceManager.getAddress(), ResourceManagerId.generate(), ResourceManagerGateway.class)
		.get(TIMEOUT.toMilliseconds(), TimeUnit.MILLISECONDS);

	grantLeadership(rmLeaderElectionService).get(TIMEOUT.toMilliseconds(), TimeUnit.MILLISECONDS);
}
 
Example #8
Source File: ResourceManagerTaskExecutorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	rpcService = new TestingRpcService();

	createAndRegisterTaskExecutorGateway();
	taskExecutorResourceID = ResourceID.generate();
	resourceManagerResourceID = ResourceID.generate();
	testingFatalErrorHandler = new TestingFatalErrorHandler();
	TestingLeaderElectionService rmLeaderElectionService = new TestingLeaderElectionService();
	resourceManager = createAndStartResourceManager(rmLeaderElectionService, testingFatalErrorHandler);
	rmGateway = resourceManager.getSelfGateway(ResourceManagerGateway.class);
	wronglyFencedGateway = rpcService.connect(resourceManager.getAddress(), ResourceManagerId.generate(), ResourceManagerGateway.class)
		.get(TIMEOUT.toMilliseconds(), TimeUnit.MILLISECONDS);

	grantLeadership(rmLeaderElectionService).get(TIMEOUT.toMilliseconds(), TimeUnit.MILLISECONDS);
}
 
Example #9
Source File: MesosResourceManagerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
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 #10
Source File: ResourceManagerJobMasterTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
	rpcService = new TestingRpcService();

	jobId = new JobID();

	createAndRegisterJobMasterGateway();
	jobMasterResourceId = ResourceID.generate();

	jobMasterLeaderRetrievalService = new SettableLeaderRetrievalService(
		jobMasterGateway.getAddress(),
		jobMasterGateway.getFencingToken().toUUID());
	resourceManagerLeaderElectionService = new TestingLeaderElectionService();

	haServices = new TestingHighAvailabilityServicesBuilder()
		.setJobMasterLeaderRetrieverFunction(requestedJobId -> {
			if (requestedJobId.equals(jobId)) {
				return jobMasterLeaderRetrievalService;
			} else {
				throw new FlinkRuntimeException(String.format("Unknown job id %s", jobId));
			}
		})
		.setResourceManagerLeaderElectionService(resourceManagerLeaderElectionService)
		.build();

	testingFatalErrorHandler = new TestingFatalErrorHandler();

	resourceManager = createAndStartResourceManager();

	// wait until the leader election has been completed
	resourceManagerLeaderElectionService.isLeader(UUID.randomUUID()).get();

	resourceManagerGateway = resourceManager.getSelfGateway(ResourceManagerGateway.class);
}
 
Example #11
Source File: ManualLeaderService.java    From flink with Apache License 2.0 5 votes vote down vote up
public void grantLeadership(int index, UUID leaderId) {
	if (currentLeaderId != null) {
		revokeLeadership();
	}

	Preconditions.checkNotNull(leaderId);
	Preconditions.checkArgument(0 <= index && index < leaderElectionServices.size());

	TestingLeaderElectionService testingLeaderElectionService = leaderElectionServices.get(index);

	testingLeaderElectionService.isLeader(leaderId);

	currentLeaderIndex = index;
	currentLeaderId = leaderId;
}
 
Example #12
Source File: ResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
	highAvailabilityServices = new TestingHighAvailabilityServices();
	resourceManagerLeaderElectionService = new TestingLeaderElectionService();
	highAvailabilityServices.setResourceManagerLeaderElectionService(resourceManagerLeaderElectionService);
	testingFatalErrorHandler = new TestingFatalErrorHandler();
	resourceManagerResourceId = ResourceID.generate();
}
 
Example #13
Source File: ManualLeaderService.java    From flink with Apache License 2.0 5 votes vote down vote up
public void revokeLeadership() {
	assert(currentLeaderId != null);
	assert(0 <= currentLeaderIndex &&  currentLeaderIndex < leaderElectionServices.size());

	TestingLeaderElectionService testingLeaderElectionService = leaderElectionServices.get(currentLeaderIndex);

	testingLeaderElectionService.notLeader();

	currentLeaderIndex = -1;
	currentLeaderId = null;
}
 
Example #14
Source File: MockResourceManagerRuntimeServices.java    From flink with Apache License 2.0 5 votes vote down vote up
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 #15
Source File: ManualLeaderService.java    From flink with Apache License 2.0 5 votes vote down vote up
private String getLeaderAddress(int index) {
	if (0 <= index && index < leaderElectionServices.size()) {
		TestingLeaderElectionService testingLeaderElectionService = leaderElectionServices.get(index);
		return testingLeaderElectionService.getAddress();
	} else {
		return null;
	}
}
 
Example #16
Source File: ManualLeaderService.java    From flink with Apache License 2.0 5 votes vote down vote up
private String getLeaderAddress(int index) {
	if (0 <= index && index < leaderElectionServices.size()) {
		TestingLeaderElectionService testingLeaderElectionService = leaderElectionServices.get(index);
		return testingLeaderElectionService.getAddress();
	} else {
		return null;
	}
}
 
Example #17
Source File: JobManagerRunnerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
	leaderElectionService = new TestingLeaderElectionService();
	haServices = new TestingHighAvailabilityServices();
	haServices.setJobMasterLeaderElectionService(jobGraph.getJobID(), leaderElectionService);
	haServices.setResourceManagerLeaderRetriever(new SettableLeaderRetrievalService());
	haServices.setCheckpointRecoveryFactory(new StandaloneCheckpointRecoveryFactory());

	fatalErrorHandler = new TestingFatalErrorHandler();
}
 
Example #18
Source File: ZooKeeperDefaultDispatcherRunnerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private DispatcherRunner createDispatcherRunner(
		TestingRpcService rpcService,
		TestingLeaderElectionService dispatcherLeaderElectionService,
		JobGraphStoreFactory jobGraphStoreFactory,
		PartialDispatcherServices partialDispatcherServices,
		DispatcherRunnerFactory dispatcherRunnerFactory) throws Exception {
	return dispatcherRunnerFactory.createDispatcherRunner(
			dispatcherLeaderElectionService,
			fatalErrorHandler,
			jobGraphStoreFactory,
			TestingUtils.defaultExecutor(),
			rpcService,
			partialDispatcherServices);
}
 
Example #19
Source File: ZooKeeperDefaultDispatcherRunnerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private DispatcherGateway grantLeadership(TestingLeaderElectionService dispatcherLeaderElectionService) throws InterruptedException, java.util.concurrent.ExecutionException {
	final UUID leaderSessionId = UUID.randomUUID();
	dispatcherLeaderElectionService.isLeader(leaderSessionId);
	final LeaderConnectionInfo leaderConnectionInfo = dispatcherLeaderElectionService.getConfirmationFuture().get();

	return testingRpcServiceResource.getTestingRpcService().connect(
		leaderConnectionInfo.getAddress(),
		DispatcherId.fromUuid(leaderSessionId),
		DispatcherGateway.class).get();
}
 
Example #20
Source File: WebMonitorEndpointTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void cleansUpExpiredExecutionGraphs() throws Exception {
	final Configuration configuration = new Configuration();
	configuration.setString(RestOptions.ADDRESS, "localhost");
	configuration.setLong(WebOptions.REFRESH_INTERVAL, 5L);
	final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
	final long timeout = 10000L;

	final OneShotLatch cleanupLatch = new OneShotLatch();
	final TestingExecutionGraphCache executionGraphCache = TestingExecutionGraphCache.newBuilder()
		.setCleanupRunnable(cleanupLatch::trigger)
		.build();
	try (final WebMonitorEndpoint<RestfulGateway> webMonitorEndpoint = new WebMonitorEndpoint<>(
		RestServerEndpointConfiguration.fromConfiguration(configuration),
		CompletableFuture::new,
		configuration,
		RestHandlerConfiguration.fromConfiguration(configuration),
		CompletableFuture::new,
		NoOpTransientBlobService.INSTANCE,
		executor,
		VoidMetricFetcher.INSTANCE,
		new TestingLeaderElectionService(),
		executionGraphCache,
		new TestingFatalErrorHandler())) {

		webMonitorEndpoint.start();

		// check that the cleanup will be triggered
		cleanupLatch.await(timeout, TimeUnit.MILLISECONDS);
	} finally {
		ExecutorUtils.gracefulShutdown(timeout, TimeUnit.MILLISECONDS, executor);
	}
}
 
Example #21
Source File: JobManagerRunnerImplTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
	leaderElectionService = new TestingLeaderElectionService();
	haServices = new TestingHighAvailabilityServices();
	haServices.setJobMasterLeaderElectionService(jobGraph.getJobID(), leaderElectionService);
	haServices.setResourceManagerLeaderRetriever(new SettableLeaderRetrievalService());
	haServices.setCheckpointRecoveryFactory(new StandaloneCheckpointRecoveryFactory());

	fatalErrorHandler = new TestingFatalErrorHandler();
}
 
Example #22
Source File: MockResourceManagerRuntimeServices.java    From flink with Apache License 2.0 5 votes vote down vote up
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 #23
Source File: ResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
	highAvailabilityServices = new TestingHighAvailabilityServices();
	resourceManagerLeaderElectionService = new TestingLeaderElectionService();
	highAvailabilityServices.setResourceManagerLeaderElectionService(resourceManagerLeaderElectionService);
	testingFatalErrorHandler = new TestingFatalErrorHandler();
	resourceManagerResourceId = ResourceID.generate();
}
 
Example #24
Source File: ResourceManagerJobMasterTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
	rpcService = new TestingRpcService();

	jobId = new JobID();

	createAndRegisterJobMasterGateway();
	jobMasterResourceId = ResourceID.generate();

	jobMasterLeaderRetrievalService = new SettableLeaderRetrievalService(
		jobMasterGateway.getAddress(),
		jobMasterGateway.getFencingToken().toUUID());
	resourceManagerLeaderElectionService = new TestingLeaderElectionService();

	haServices = new TestingHighAvailabilityServicesBuilder()
		.setJobMasterLeaderRetrieverFunction(requestedJobId -> {
			if (requestedJobId.equals(jobId)) {
				return jobMasterLeaderRetrievalService;
			} else {
				throw new FlinkRuntimeException(String.format("Unknown job id %s", jobId));
			}
		})
		.setResourceManagerLeaderElectionService(resourceManagerLeaderElectionService)
		.build();

	testingFatalErrorHandler = new TestingFatalErrorHandler();

	resourceManager = createAndStartResourceManager();

	// wait until the leader election has been completed
	resourceManagerLeaderElectionService.isLeader(UUID.randomUUID()).get();

	resourceManagerGateway = resourceManager.getSelfGateway(ResourceManagerGateway.class);
}
 
Example #25
Source File: ResourceManagerPartitionLifecycleTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
	highAvailabilityServices = new TestingHighAvailabilityServices();
	resourceManagerLeaderElectionService = new TestingLeaderElectionService();
	highAvailabilityServices.setResourceManagerLeaderElectionService(resourceManagerLeaderElectionService);
	testingFatalErrorHandler = new TestingFatalErrorHandler();
}
 
Example #26
Source File: ManualLeaderService.java    From flink with Apache License 2.0 5 votes vote down vote up
public void grantLeadership(int index, UUID leaderId) {
	if (currentLeaderId != null) {
		revokeLeadership();
	}

	Preconditions.checkNotNull(leaderId);
	Preconditions.checkArgument(0 <= index && index < leaderElectionServices.size());

	TestingLeaderElectionService testingLeaderElectionService = leaderElectionServices.get(index);

	testingLeaderElectionService.isLeader(leaderId);

	currentLeaderIndex = index;
	currentLeaderId = leaderId;
}
 
Example #27
Source File: ManualLeaderService.java    From flink with Apache License 2.0 5 votes vote down vote up
public void revokeLeadership() {
	assert(currentLeaderId != null);
	assert(0 <= currentLeaderIndex &&  currentLeaderIndex < leaderElectionServices.size());

	TestingLeaderElectionService testingLeaderElectionService = leaderElectionServices.get(currentLeaderIndex);

	testingLeaderElectionService.notLeader();

	currentLeaderIndex = -1;
	currentLeaderId = null;
}
 
Example #28
Source File: DispatcherTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	final JobVertex testVertex = new JobVertex("testVertex");
	testVertex.setInvokableClass(NoOpInvokable.class);
	jobGraph = new JobGraph(TEST_JOB_ID, "testJob", testVertex);
	jobGraph.setAllowQueuedScheduling(true);

	fatalErrorHandler = new TestingFatalErrorHandler();
	heartbeatServices = new HeartbeatServices(1000L, 10000L);
	submittedJobGraphStore = new FaultySubmittedJobGraphStore();

	dispatcherLeaderElectionService = new TestingLeaderElectionService();
	jobMasterLeaderElectionService = new TestingLeaderElectionService();

	haServices = new TestingHighAvailabilityServices();
	haServices.setDispatcherLeaderElectionService(dispatcherLeaderElectionService);
	haServices.setSubmittedJobGraphStore(submittedJobGraphStore);
	haServices.setJobMasterLeaderElectionService(TEST_JOB_ID, jobMasterLeaderElectionService);
	haServices.setCheckpointRecoveryFactory(new StandaloneCheckpointRecoveryFactory());
	haServices.setResourceManagerLeaderRetriever(new SettableLeaderRetrievalService());
	runningJobsRegistry = haServices.getRunningJobsRegistry();

	configuration = new Configuration();

	configuration.setString(
		BlobServerOptions.STORAGE_DIRECTORY,
		temporaryFolder.newFolder().getAbsolutePath());

	createdJobManagerRunnerLatch = new CountDownLatch(2);
	blobServer = new BlobServer(configuration, new VoidBlobStore());
}
 
Example #29
Source File: DispatcherTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	final JobVertex testVertex = new JobVertex("testVertex");
	testVertex.setInvokableClass(NoOpInvokable.class);
	jobGraph = new JobGraph(TEST_JOB_ID, "testJob", testVertex);
	jobGraph.setAllowQueuedScheduling(true);

	fatalErrorHandler = new TestingFatalErrorHandler();
	heartbeatServices = new HeartbeatServices(1000L, 10000L);
	submittedJobGraphStore = new FaultySubmittedJobGraphStore();

	dispatcherLeaderElectionService = new TestingLeaderElectionService();
	jobMasterLeaderElectionService = new TestingLeaderElectionService();

	haServices = new TestingHighAvailabilityServices();
	haServices.setDispatcherLeaderElectionService(dispatcherLeaderElectionService);
	haServices.setSubmittedJobGraphStore(submittedJobGraphStore);
	haServices.setJobMasterLeaderElectionService(TEST_JOB_ID, jobMasterLeaderElectionService);
	haServices.setCheckpointRecoveryFactory(new StandaloneCheckpointRecoveryFactory());
	haServices.setResourceManagerLeaderRetriever(new SettableLeaderRetrievalService());
	runningJobsRegistry = haServices.getRunningJobsRegistry();

	configuration = new Configuration();

	configuration.setString(
		BlobServerOptions.STORAGE_DIRECTORY,
		temporaryFolder.newFolder().getAbsolutePath());

	createdJobManagerRunnerLatch = new CountDownLatch(2);
	blobServer = new BlobServer(configuration, new VoidBlobStore());
}
 
Example #30
Source File: MiniDispatcherTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
	dispatcherLeaderElectionService = new TestingLeaderElectionService();
	highAvailabilityServices = new TestingHighAvailabilityServices();
	testingFatalErrorHandler = new TestingFatalErrorHandler();

	highAvailabilityServices.setDispatcherLeaderElectionService(dispatcherLeaderElectionService);

	jobGraphFuture = new CompletableFuture<>();
	resultFuture = new CompletableFuture<>();

	testingJobManagerRunnerFactory = new TestingJobManagerRunnerFactory(jobGraphFuture, resultFuture, CompletableFuture.completedFuture(null));
}