org.apache.flink.runtime.util.TestingFatalErrorHandler Java Examples

The following examples show how to use org.apache.flink.runtime.util.TestingFatalErrorHandler. 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
@Before
public void setup() {
	testingFatalErrorHandler = new TestingFatalErrorHandler();

	flinkConfig = new Configuration();
	flinkConfig.setInteger(ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN, 100);

	File root = folder.getRoot();
	File home = new File(root, "home");
	boolean created = home.mkdir();
	assertTrue(created);

	env = new HashMap<>();
	env.put(ENV_APP_ID, "foo");
	env.put(ENV_CLIENT_HOME_DIR, home.getAbsolutePath());
	env.put(ENV_CLIENT_SHIP_FILES, "");
	env.put(ENV_FLINK_CLASSPATH, "");
	env.put(ENV_HADOOP_USER_NAME, "foo");
	env.put(FLINK_JAR_PATH, root.toURI().toString());
}
 
Example #2
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 #3
Source File: TaskExecutorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws IOException {
	rpc = new TestingRpcService();

	dummyBlobCacheService = new BlobCacheService(
		new Configuration(),
		new VoidBlobStore(),
		null);

	configuration = new Configuration();

	unresolvedTaskManagerLocation = new LocalUnresolvedTaskManagerLocation();
	jobId = new JobID();

	testingFatalErrorHandler = new TestingFatalErrorHandler();

	haServices = new TestingHighAvailabilityServices();
	resourceManagerLeaderRetriever = new SettableLeaderRetrievalService();
	jobManagerLeaderRetriever = new SettableLeaderRetrievalService();
	haServices.setResourceManagerLeaderRetriever(resourceManagerLeaderRetriever);
	haServices.setJobMasterLeaderRetriever(jobId, jobManagerLeaderRetriever);

	nettyShuffleEnvironment = new NettyShuffleEnvironmentBuilder().build();
}
 
Example #4
Source File: JobMasterTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws IOException {
	configuration = new Configuration();
	haServices = new TestingHighAvailabilityServices();
	jobMasterId = JobMasterId.generate();
	jmResourceId = ResourceID.generate();

	testingFatalErrorHandler = new TestingFatalErrorHandler();

	haServices.setCheckpointRecoveryFactory(new StandaloneCheckpointRecoveryFactory());

	rmLeaderRetrievalService = new SettableLeaderRetrievalService(
		null,
		null);
	haServices.setResourceManagerLeaderRetriever(rmLeaderRetrievalService);

	configuration.setString(BlobServerOptions.STORAGE_DIRECTORY, temporaryFolder.newFolder().getAbsolutePath());
}
 
Example #5
Source File: SessionDispatcherLeaderProcessTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private void runOnAddedJobGraphTest(TestingDispatcherGateway dispatcherGateway, ThrowingConsumer<TestingFatalErrorHandler, Exception> verificationLogic) throws Exception {
	jobGraphStore = TestingJobGraphStore.newBuilder()
		.setInitialJobGraphs(Collections.singleton(JOB_GRAPH))
		.build();
	dispatcherServiceFactory = TestingDispatcherServiceFactory.newBuilder()
		.setCreateFunction((dispatcherId, jobGraphs, jobGraphWriter) -> {
			assertThat(jobGraphs, containsInAnyOrder(JOB_GRAPH));

			return TestingDispatcherGatewayService.newBuilder()
				.setDispatcherGateway(dispatcherGateway)
				.build();
		})
		.build();

	try (final SessionDispatcherLeaderProcess dispatcherLeaderProcess = createDispatcherLeaderProcess()) {
		dispatcherLeaderProcess.start();

		dispatcherLeaderProcess.getDispatcherGateway().get();

		dispatcherLeaderProcess.onAddedJobGraph(JOB_GRAPH.getJobID());

		verificationLogic.accept(fatalErrorHandler);
	}
}
 
Example #6
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 #7
Source File: ActiveResourceManagerFactoryTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Test which ensures that the {@link ActiveResourceManagerFactory} sets the correct managed
 * memory when creating a resource manager.
 */
@Test
public void createResourceManager_WithDefaultConfiguration_ShouldSetManagedMemory() throws Exception {
	final Configuration configuration = new Configuration();

	final TestingActiveResourceManagerFactory resourceManagerFactory = new TestingActiveResourceManagerFactory();

	final TestingRpcService rpcService = new TestingRpcService();

	try {
		final ResourceManager<ResourceID> ignored = resourceManagerFactory.createResourceManager(
			configuration,
			ResourceID.generate(),
			rpcService,
			new TestingHighAvailabilityServices(),
			new TestingHeartbeatServices(),
			NoOpMetricRegistry.INSTANCE,
			new TestingFatalErrorHandler(),
			new ClusterInformation("foobar", 1234),
			null,
			UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup());
	} finally {
		RpcUtils.terminateRpcService(rpcService, Time.seconds(10L));
	}
}
 
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: StandaloneResourceManagerFactoryTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void createResourceManager_WithLessMemoryThanContainerizedHeapCutoffMin_ShouldSucceed() throws Exception {
	final StandaloneResourceManagerFactory resourceManagerFactory = StandaloneResourceManagerFactory.INSTANCE;

	final TestingRpcService rpcService = new TestingRpcService();
	try {
		final Configuration configuration = new Configuration();
		configuration.setString(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY, new MemorySize(128 * 1024 * 1024).toString());
		configuration.setInteger(ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN, 600);

		final ResourceManager<ResourceID> ignored = resourceManagerFactory.createResourceManager(
			configuration,
			ResourceID.generate(),
			rpcService,
			new TestingHighAvailabilityServices(),
			new TestingHeartbeatServices(),
			NoOpMetricRegistry.INSTANCE,
			new TestingFatalErrorHandler(),
			new ClusterInformation("foobar", 1234),
			null,
			UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup());
	} finally {
		RpcUtils.terminateRpcService(rpcService, Time.seconds(10L));
	}
}
 
Example #10
Source File: TaskExecutorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws IOException {
	rpc = new TestingRpcService();
	timerService = new TimerService<>(TestingUtils.defaultExecutor(), timeout.toMilliseconds());

	dummyBlobCacheService = new BlobCacheService(
		new Configuration(),
		new VoidBlobStore(),
		null);

	configuration = new Configuration();
	taskManagerConfiguration = TaskManagerConfiguration.fromConfiguration(configuration);

	taskManagerLocation = new LocalTaskManagerLocation();
	jobId = new JobID();

	testingFatalErrorHandler = new TestingFatalErrorHandler();

	haServices = new TestingHighAvailabilityServices();
	resourceManagerLeaderRetriever = new SettableLeaderRetrievalService();
	jobManagerLeaderRetriever = new SettableLeaderRetrievalService();
	haServices.setResourceManagerLeaderRetriever(resourceManagerLeaderRetriever);
	haServices.setJobMasterLeaderRetriever(jobId, jobManagerLeaderRetriever);

	nettyShuffleEnvironment = new NettyShuffleEnvironmentBuilder().build();
}
 
Example #11
Source File: JobMasterTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws IOException {
	configuration = new Configuration();
	haServices = new TestingHighAvailabilityServices();
	jobMasterId = JobMasterId.generate();
	jmResourceId = ResourceID.generate();

	testingFatalErrorHandler = new TestingFatalErrorHandler();

	haServices.setCheckpointRecoveryFactory(new StandaloneCheckpointRecoveryFactory());

	rmLeaderRetrievalService = new SettableLeaderRetrievalService(
		null,
		null);
	haServices.setResourceManagerLeaderRetriever(rmLeaderRetrievalService);

	configuration.setString(BlobServerOptions.STORAGE_DIRECTORY, temporaryFolder.newFolder().getAbsolutePath());
}
 
Example #12
Source File: YarnResourceManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() {
	testingFatalErrorHandler = new TestingFatalErrorHandler();

	flinkConfig = new Configuration();
	flinkConfig.setInteger(ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN, 100);

	File root = folder.getRoot();
	File home = new File(root, "home");
	boolean created = home.mkdir();
	assertTrue(created);

	env = new HashMap<>();
	env.put(ENV_APP_ID, "foo");
	env.put(ENV_CLIENT_HOME_DIR, home.getAbsolutePath());
	env.put(ENV_CLIENT_SHIP_FILES, "");
	env.put(ENV_FLINK_CLASSPATH, "");
	env.put(ENV_HADOOP_USER_NAME, "foo");
	env.put(FLINK_JAR_PATH, root.toURI().toString());
}
 
Example #13
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 #14
Source File: TaskExecutorTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws IOException {
	rpc = new TestingRpcService();
	timerService = new TimerService<>(TestingUtils.defaultExecutor(), timeout.toMilliseconds());

	dummyBlobCacheService = new BlobCacheService(
		new Configuration(),
		new VoidBlobStore(),
		null);

	configuration = new Configuration();
	taskManagerConfiguration = TaskManagerConfiguration.fromConfiguration(configuration);

	taskManagerLocation = new LocalTaskManagerLocation();
	jobId = new JobID();

	testingFatalErrorHandler = new TestingFatalErrorHandler();

	haServices = new TestingHighAvailabilityServices();
	resourceManagerLeaderRetriever = new SettableLeaderRetrievalService();
	jobManagerLeaderRetriever = new SettableLeaderRetrievalService();
	haServices.setResourceManagerLeaderRetriever(resourceManagerLeaderRetriever);
	haServices.setJobMasterLeaderRetriever(jobId, jobManagerLeaderRetriever);
}
 
Example #15
Source File: JobMasterTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws IOException {
	configuration = new Configuration();
	haServices = new TestingHighAvailabilityServices();
	jobMasterId = JobMasterId.generate();
	jmResourceId = ResourceID.generate();

	testingFatalErrorHandler = new TestingFatalErrorHandler();

	haServices.setCheckpointRecoveryFactory(new StandaloneCheckpointRecoveryFactory());

	rmLeaderRetrievalService = new SettableLeaderRetrievalService(
		null,
		null);
	haServices.setResourceManagerLeaderRetriever(rmLeaderRetrievalService);

	configuration.setString(BlobServerOptions.STORAGE_DIRECTORY, temporaryFolder.newFolder().getAbsolutePath());
}
 
Example #16
Source File: YarnResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws IOException {
	testingFatalErrorHandler = new TestingFatalErrorHandler();

	flinkConfig = new Configuration();
	flinkConfig.set(TaskManagerOptions.TOTAL_FLINK_MEMORY, MemorySize.parse("1g"));

	File root = folder.getRoot();
	File home = new File(root, "home");
	boolean created = home.mkdir();
	assertTrue(created);

	env = new HashMap<>();
	env.put(ENV_APP_ID, "foo");
	env.put(ENV_CLIENT_HOME_DIR, home.getAbsolutePath());
	env.put(ENV_CLIENT_SHIP_FILES, "");
	env.put(ENV_FLINK_CLASSPATH, "");
	env.put(ENV_HADOOP_USER_NAME, "foo");
	env.put(FLINK_DIST_JAR, new YarnLocalResourceDescriptor(
		"flink.jar",
		new Path("/tmp/flink.jar"),
		0,
		System.currentTimeMillis(),
		LocalResourceVisibility.APPLICATION).toString());
	env.put(ApplicationConstants.Environment.PWD.key(), home.getAbsolutePath());

	BootstrapTools.writeConfiguration(flinkConfig, new File(home.getAbsolutePath(), FLINK_CONF_FILENAME));
}
 
Example #17
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 #18
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 #19
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 #20
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 #21
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 #22
Source File: ZooKeeperDefaultDispatcherRunnerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws IOException {
	fatalErrorHandler = new TestingFatalErrorHandler();
	configuration = new Configuration();
	configuration.setString(HighAvailabilityOptions.HA_MODE, "zookeeper");
	configuration.setString(HighAvailabilityOptions.HA_ZOOKEEPER_QUORUM, zooKeeperResource.getConnectString());
	configuration.setString(HighAvailabilityOptions.HA_STORAGE_PATH, temporaryFolder.newFolder().getAbsolutePath());

	clusterHaStorageDir = new File(HighAvailabilityServicesUtils.getClusterHighAvailableStoragePath(configuration).toString());
	blobServer = new BlobServer(configuration, BlobUtils.createBlobStoreFromConfig(configuration));
}
 
Example #23
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 #24
Source File: ResourceManagerJobMasterTest.java    From Flink-CEPplus 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: 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));
}
 
Example #26
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 #27
Source File: JobManagerRunnerTest.java    From Flink-CEPplus 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 #28
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 #29
Source File: ResourceManagerTest.java    From Flink-CEPplus 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 #30
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();
}