org.apache.flink.runtime.dispatcher.MemoryArchivedExecutionGraphStore Java Examples

The following examples show how to use org.apache.flink.runtime.dispatcher.MemoryArchivedExecutionGraphStore. 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: MiniCluster.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
protected Collection<? extends DispatcherResourceManagerComponent<?>> createDispatcherResourceManagerComponents(
		Configuration configuration,
		RpcServiceFactory rpcServiceFactory,
		HighAvailabilityServices haServices,
		BlobServer blobServer,
		HeartbeatServices heartbeatServices,
		MetricRegistry metricRegistry,
		MetricQueryServiceRetriever metricQueryServiceRetriever,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	SessionDispatcherResourceManagerComponentFactory dispatcherResourceManagerComponentFactory = createDispatcherResourceManagerComponentFactory();
	return Collections.singleton(
		dispatcherResourceManagerComponentFactory.create(
			configuration,
			rpcServiceFactory.createRpcService(),
			haServices,
			blobServer,
			heartbeatServices,
			metricRegistry,
			new MemoryArchivedExecutionGraphStore(),
			metricQueryServiceRetriever,
			fatalErrorHandler));
}
 
Example #2
Source File: MiniCluster.java    From flink with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
protected Collection<? extends DispatcherResourceManagerComponent<?>> createDispatcherResourceManagerComponents(
		Configuration configuration,
		RpcServiceFactory rpcServiceFactory,
		HighAvailabilityServices haServices,
		BlobServer blobServer,
		HeartbeatServices heartbeatServices,
		MetricRegistry metricRegistry,
		MetricQueryServiceRetriever metricQueryServiceRetriever,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	SessionDispatcherResourceManagerComponentFactory dispatcherResourceManagerComponentFactory = createDispatcherResourceManagerComponentFactory();
	return Collections.singleton(
		dispatcherResourceManagerComponentFactory.create(
			configuration,
			rpcServiceFactory.createRpcService(),
			haServices,
			blobServer,
			heartbeatServices,
			metricRegistry,
			new MemoryArchivedExecutionGraphStore(),
			metricQueryServiceRetriever,
			fatalErrorHandler));
}
 
Example #3
Source File: MiniCluster.java    From flink with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
protected Collection<? extends DispatcherResourceManagerComponent> createDispatcherResourceManagerComponents(
		Configuration configuration,
		RpcServiceFactory rpcServiceFactory,
		HighAvailabilityServices haServices,
		BlobServer blobServer,
		HeartbeatServices heartbeatServices,
		MetricRegistry metricRegistry,
		MetricQueryServiceRetriever metricQueryServiceRetriever,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	DispatcherResourceManagerComponentFactory dispatcherResourceManagerComponentFactory = createDispatcherResourceManagerComponentFactory();
	return Collections.singleton(
		dispatcherResourceManagerComponentFactory.create(
			configuration,
			ioExecutor,
			rpcServiceFactory.createRpcService(),
			haServices,
			blobServer,
			heartbeatServices,
			metricRegistry,
			new MemoryArchivedExecutionGraphStore(),
			metricQueryServiceRetriever,
			fatalErrorHandler));
}
 
Example #4
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 #5
Source File: TestingMiniCluster.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected Collection<? extends DispatcherResourceManagerComponent<?>> createDispatcherResourceManagerComponents(
		Configuration configuration,
		RpcServiceFactory rpcServiceFactory,
		HighAvailabilityServices haServices,
		BlobServer blobServer,
		HeartbeatServices heartbeatServices,
		MetricRegistry metricRegistry,
		MetricQueryServiceRetriever metricQueryServiceRetriever,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	SessionDispatcherResourceManagerComponentFactory dispatcherResourceManagerComponentFactory = createTestingDispatcherResourceManagerComponentFactory();

	final List<DispatcherResourceManagerComponent<?>> result = new ArrayList<>(numberDispatcherResourceManagerComponents);

	for (int i = 0; i < numberDispatcherResourceManagerComponents; i++) {
		result.add(
			dispatcherResourceManagerComponentFactory.create(
				configuration,
				rpcServiceFactory.createRpcService(),
				haServices,
				blobServer,
				heartbeatServices,
				metricRegistry,
				new MemoryArchivedExecutionGraphStore(),
				metricQueryServiceRetriever,
				fatalErrorHandler));
	}

	return result;
}
 
Example #6
Source File: TestingMiniCluster.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected Collection<? extends DispatcherResourceManagerComponent<?>> createDispatcherResourceManagerComponents(
		Configuration configuration,
		RpcServiceFactory rpcServiceFactory,
		HighAvailabilityServices haServices,
		BlobServer blobServer,
		HeartbeatServices heartbeatServices,
		MetricRegistry metricRegistry,
		MetricQueryServiceRetriever metricQueryServiceRetriever,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	SessionDispatcherResourceManagerComponentFactory dispatcherResourceManagerComponentFactory = createTestingDispatcherResourceManagerComponentFactory();

	final List<DispatcherResourceManagerComponent<?>> result = new ArrayList<>(numberDispatcherResourceManagerComponents);

	for (int i = 0; i < numberDispatcherResourceManagerComponents; i++) {
		result.add(
			dispatcherResourceManagerComponentFactory.create(
				configuration,
				rpcServiceFactory.createRpcService(),
				haServices,
				blobServer,
				heartbeatServices,
				metricRegistry,
				new MemoryArchivedExecutionGraphStore(),
				metricQueryServiceRetriever,
				fatalErrorHandler));
	}

	return result;
}
 
Example #7
Source File: TestingMiniCluster.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected Collection<? extends DispatcherResourceManagerComponent> createDispatcherResourceManagerComponents(
		Configuration configuration,
		RpcServiceFactory rpcServiceFactory,
		HighAvailabilityServices haServices,
		BlobServer blobServer,
		HeartbeatServices heartbeatServices,
		MetricRegistry metricRegistry,
		MetricQueryServiceRetriever metricQueryServiceRetriever,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	DispatcherResourceManagerComponentFactory dispatcherResourceManagerComponentFactory = createDispatcherResourceManagerComponentFactory();

	final List<DispatcherResourceManagerComponent> result = new ArrayList<>(numberDispatcherResourceManagerComponents);

	for (int i = 0; i < numberDispatcherResourceManagerComponents; i++) {
		result.add(
			dispatcherResourceManagerComponentFactory.create(
				configuration,
				getIOExecutor(),
				rpcServiceFactory.createRpcService(),
				haServices,
				blobServer,
				heartbeatServices,
				metricRegistry,
				new MemoryArchivedExecutionGraphStore(),
				metricQueryServiceRetriever,
				fatalErrorHandler));
	}

	return result;
}
 
Example #8
Source File: JobClusterEntrypoint.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
protected ArchivedExecutionGraphStore createSerializableExecutionGraphStore(
		Configuration configuration,
		ScheduledExecutor scheduledExecutor) {
	return new MemoryArchivedExecutionGraphStore();
}
 
Example #9
Source File: JobClusterEntrypoint.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected ArchivedExecutionGraphStore createSerializableExecutionGraphStore(
		Configuration configuration,
		ScheduledExecutor scheduledExecutor) {
	return new MemoryArchivedExecutionGraphStore();
}
 
Example #10
Source File: JobClusterEntrypoint.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected ArchivedExecutionGraphStore createSerializableExecutionGraphStore(
		Configuration configuration,
		ScheduledExecutor scheduledExecutor) {
	return new MemoryArchivedExecutionGraphStore();
}
 
Example #11
Source File: ZooKeeperDefaultDispatcherRunnerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * See FLINK-11665.
 */
@Test
public void testResourceCleanupUnderLeadershipChange() throws Exception {
	final TestingRpcService rpcService = testingRpcServiceResource.getTestingRpcService();
	final TestingLeaderElectionService dispatcherLeaderElectionService = new TestingLeaderElectionService();

	final CuratorFramework client = ZooKeeperUtils.startCuratorFramework(configuration);
	try (final TestingHighAvailabilityServices highAvailabilityServices = new TestingHighAvailabilityServicesBuilder()
			.setRunningJobsRegistry(new ZooKeeperRunningJobsRegistry(client, configuration))
			.setDispatcherLeaderElectionService(dispatcherLeaderElectionService)
			.setJobMasterLeaderRetrieverFunction(jobId -> ZooKeeperUtils.createLeaderRetrievalService(client, configuration))
			.build()) {

		final PartialDispatcherServices partialDispatcherServices = new PartialDispatcherServices(
			configuration,
			highAvailabilityServices,
			CompletableFuture::new,
			blobServer,
			new TestingHeartbeatServices(),
			UnregisteredMetricGroups::createUnregisteredJobManagerMetricGroup,
			new MemoryArchivedExecutionGraphStore(),
			fatalErrorHandler,
			VoidHistoryServerArchivist.INSTANCE,
			null);

		final JobGraph jobGraph = createJobGraphWithBlobs();

		final DefaultDispatcherRunnerFactory defaultDispatcherRunnerFactory = DefaultDispatcherRunnerFactory.createSessionRunner(SessionDispatcherFactory.INSTANCE);

		try (final DispatcherRunner dispatcherRunner = createDispatcherRunner(
			rpcService,
			dispatcherLeaderElectionService,
			() -> createZooKeeperJobGraphStore(client),
			partialDispatcherServices,
			defaultDispatcherRunnerFactory)) {

			// initial run
			DispatcherGateway dispatcherGateway = grantLeadership(dispatcherLeaderElectionService);

			LOG.info("Initial job submission {}.", jobGraph.getJobID());
			dispatcherGateway.submitJob(jobGraph, TESTING_TIMEOUT).get();

			dispatcherLeaderElectionService.notLeader();

			// recovering submitted jobs
			LOG.info("Re-grant leadership first time.");
			dispatcherGateway = grantLeadership(dispatcherLeaderElectionService);

			LOG.info("Cancel recovered job {}.", jobGraph.getJobID());
			// cancellation of the job should remove everything
			final CompletableFuture<JobResult> jobResultFuture = dispatcherGateway.requestJobResult(jobGraph.getJobID(), TESTING_TIMEOUT);
			dispatcherGateway.cancelJob(jobGraph.getJobID(), TESTING_TIMEOUT).get();

			// a successful cancellation should eventually remove all job information
			final JobResult jobResult = jobResultFuture.get();

			assertThat(jobResult.getApplicationStatus(), is(ApplicationStatus.CANCELED));

			dispatcherLeaderElectionService.notLeader();

			// check that the job has been removed from ZooKeeper
			final ZooKeeperJobGraphStore submittedJobGraphStore = createZooKeeperJobGraphStore(client);

			CommonTestUtils.waitUntilCondition(() -> submittedJobGraphStore.getJobIds().isEmpty(), Deadline.fromNow(VERIFICATION_TIMEOUT), 20L);
		}
	}

	// check resource clean up
	assertThat(clusterHaStorageDir.listFiles(), is(emptyArray()));
}
 
Example #12
Source File: ApplicationClusterEntryPoint.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected ArchivedExecutionGraphStore createSerializableExecutionGraphStore(
		final Configuration configuration,
		final ScheduledExecutor scheduledExecutor) {
	return new MemoryArchivedExecutionGraphStore();
}