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

The following examples show how to use org.apache.flink.runtime.dispatcher.DispatcherId. 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: ApplicationDispatcherGatewayServiceFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public AbstractDispatcherLeaderProcess.DispatcherGatewayService create(
		DispatcherId fencingToken,
		Collection<JobGraph> recoveredJobs,
		JobGraphWriter jobGraphWriter) {

	final DispatcherBootstrap bootstrap =
			new ApplicationDispatcherBootstrap(application, recoveredJobs, configuration);

	final Dispatcher dispatcher;
	try {
		dispatcher = dispatcherFactory.createDispatcher(
				rpcService,
				fencingToken,
				bootstrap,
				PartialDispatcherServicesWithJobGraphStore.from(partialDispatcherServices, jobGraphWriter));
	} catch (Exception e) {
		throw new FlinkRuntimeException("Could not create the Dispatcher rpc endpoint.", e);
	}

	dispatcher.start();

	return DefaultDispatcherGatewayService.from(dispatcher);
}
 
Example #2
Source File: DefaultDispatcherGatewayServiceFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public AbstractDispatcherLeaderProcess.DispatcherGatewayService create(
		DispatcherId fencingToken,
		Collection<JobGraph> recoveredJobs,
		JobGraphWriter jobGraphWriter) {

	final DispatcherBootstrap bootstrap =
			new DefaultDispatcherBootstrap(recoveredJobs);

	final Dispatcher dispatcher;
	try {
		dispatcher = dispatcherFactory.createDispatcher(
			rpcService,
			fencingToken,
			bootstrap,
			PartialDispatcherServicesWithJobGraphStore.from(partialDispatcherServices, jobGraphWriter));
	} catch (Exception e) {
		throw new FlinkRuntimeException("Could not create the Dispatcher rpc endpoint.", e);
	}

	dispatcher.start();

	return DefaultDispatcherGatewayService.from(dispatcher);
}
 
Example #3
Source File: JobDispatcherLeaderProcess.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected void onStart() {
	final DispatcherGatewayService dispatcherService = dispatcherGatewayServiceFactory.create(
		DispatcherId.fromUuid(getLeaderSessionId()),
		Collections.singleton(jobGraph),
		ThrowingJobGraphWriter.INSTANCE);

	completeDispatcherSetup(dispatcherService);
}
 
Example #4
Source File: TestingDispatcherServiceFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public AbstractDispatcherLeaderProcess.DispatcherGatewayService create(
		DispatcherId fencingToken,
		Collection<JobGraph> recoveredJobs,
		JobGraphWriter jobGraphWriter) {
	return createFunction.apply(fencingToken, recoveredJobs, jobGraphWriter);
}
 
Example #5
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 #6
Source File: DefaultDispatcherRunnerITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Dispatcher createDispatcher(
	RpcService rpcService,
	DispatcherId fencingToken,
	DispatcherBootstrap dispatcherBootstrap,
	PartialDispatcherServicesWithJobGraphStore partialDispatcherServicesWithJobGraphStore) throws Exception {
	return new StandaloneDispatcher(
		rpcService,
		fencingToken,
		dispatcherBootstrap,
		DispatcherServices.from(partialDispatcherServicesWithJobGraphStore, jobManagerRunnerFactory));
}
 
Example #7
Source File: DefaultDispatcherRunnerITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private DispatcherGateway electLeaderAndRetrieveGateway(UUID firstLeaderSessionId) throws InterruptedException, java.util.concurrent.ExecutionException {
	dispatcherLeaderElectionService.isLeader(firstLeaderSessionId);
	final LeaderConnectionInfo leaderConnectionInfo = dispatcherLeaderElectionService.getConfirmationFuture().get();

	return rpcServiceResource.getTestingRpcService().connect(
		leaderConnectionInfo.getAddress(),
		DispatcherId.fromUuid(leaderConnectionInfo.getLeaderSessionId()),
		DispatcherGateway.class).get();
}
 
Example #8
Source File: ProcessFailureCancelingITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to wait until the {@link Dispatcher} has set its fencing token.
 *
 * @param rpcService to use to connect to the dispatcher
 * @param haServices high availability services to connect to the dispatcher
 * @return {@link DispatcherGateway}
 * @throws Exception if something goes wrong
 */
static DispatcherGateway retrieveDispatcherGateway(RpcService rpcService, HighAvailabilityServices haServices) throws Exception {
	final LeaderConnectionInfo leaderConnectionInfo = LeaderRetrievalUtils.retrieveLeaderConnectionInfo(haServices.getDispatcherLeaderRetriever(), Time.seconds(10L));

	return rpcService.connect(
		leaderConnectionInfo.getAddress(),
		DispatcherId.fromUuid(leaderConnectionInfo.getLeaderSessionID()),
		DispatcherGateway.class).get();
}
 
Example #9
Source File: SessionDispatcherLeaderProcess.java    From flink with Apache License 2.0 5 votes vote down vote up
private void createDispatcher(Collection<JobGraph> jobGraphs) {

		final DispatcherGatewayService dispatcherService = dispatcherGatewayServiceFactory.create(
			DispatcherId.fromUuid(getLeaderSessionId()),
			jobGraphs,
			jobGraphStore);

		completeDispatcherSetup(dispatcherService);
	}
 
Example #10
Source File: ProcessFailureCancelingITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to wait until the {@link Dispatcher} has set its fencing token.
 *
 * @param rpcService to use to connect to the dispatcher
 * @param haServices high availability services to connect to the dispatcher
 * @return {@link DispatcherGateway}
 * @throws Exception if something goes wrong
 */
static DispatcherGateway retrieveDispatcherGateway(RpcService rpcService, HighAvailabilityServices haServices) throws Exception {
	final LeaderConnectionInfo leaderConnectionInfo = LeaderRetrievalUtils.retrieveLeaderConnectionInfo(
		haServices.getDispatcherLeaderRetriever(),
		Duration.ofSeconds(10L));

	return rpcService.connect(
		leaderConnectionInfo.getAddress(),
		DispatcherId.fromUuid(leaderConnectionInfo.getLeaderSessionId()),
		DispatcherGateway.class).get();
}
 
Example #11
Source File: TestingDispatcherGateway.java    From flink with Apache License 2.0 5 votes vote down vote up
public TestingDispatcherGateway(
		String address,
		String hostname,
		Function<JobID, CompletableFuture<Acknowledge>> cancelJobFunction,
		Function<JobID, CompletableFuture<ArchivedExecutionGraph>> requestJobFunction,
		Function<JobID, CompletableFuture<JobResult>> requestJobResultFunction,
		Function<JobID, CompletableFuture<JobStatus>> requestJobStatusFunction,
		Supplier<CompletableFuture<MultipleJobsDetails>> requestMultipleJobDetailsSupplier,
		Supplier<CompletableFuture<ClusterOverview>> requestClusterOverviewSupplier,
		Supplier<CompletableFuture<Collection<String>>> requestMetricQueryServiceAddressesSupplier,
		Supplier<CompletableFuture<Collection<Tuple2<ResourceID, String>>>> requestTaskManagerMetricQueryServiceGatewaysSupplier,
		BiFunction<JobID, JobVertexID, CompletableFuture<OperatorBackPressureStatsResponse>> requestOperatorBackPressureStatsFunction,
		BiFunction<JobID, String, CompletableFuture<String>> triggerSavepointFunction,
		BiFunction<JobID, String, CompletableFuture<String>> stopWithSavepointFunction,
		Function<JobGraph, CompletableFuture<Acknowledge>> submitFunction,
		Supplier<CompletableFuture<Collection<JobID>>> listFunction,
		int blobServerPort,
		DispatcherId fencingToken,
		Function<JobID, CompletableFuture<ArchivedExecutionGraph>> requestArchivedJobFunction) {
	super(
		address,
		hostname,
		cancelJobFunction,
		requestJobFunction,
		requestJobResultFunction,
		requestJobStatusFunction,
		requestMultipleJobDetailsSupplier,
		requestClusterOverviewSupplier,
		requestMetricQueryServiceAddressesSupplier,
		requestTaskManagerMetricQueryServiceGatewaysSupplier,
		requestOperatorBackPressureStatsFunction,
		triggerSavepointFunction,
		stopWithSavepointFunction);
	this.submitFunction = submitFunction;
	this.listFunction = listFunction;
	this.blobServerPort = blobServerPort;
	this.fencingToken = fencingToken;
	this.requestArchivedJobFunction = requestArchivedJobFunction;
}
 
Example #12
Source File: ProcessFailureCancelingITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to wait until the {@link Dispatcher} has set its fencing token.
 *
 * @param rpcService to use to connect to the dispatcher
 * @param haServices high availability services to connect to the dispatcher
 * @return {@link DispatcherGateway}
 * @throws Exception if something goes wrong
 */
static DispatcherGateway retrieveDispatcherGateway(RpcService rpcService, HighAvailabilityServices haServices) throws Exception {
	final LeaderConnectionInfo leaderConnectionInfo = LeaderRetrievalUtils.retrieveLeaderConnectionInfo(haServices.getDispatcherLeaderRetriever(), Time.seconds(10L));

	return rpcService.connect(
		leaderConnectionInfo.getAddress(),
		DispatcherId.fromUuid(leaderConnectionInfo.getLeaderSessionID()),
		DispatcherGateway.class).get();
}
 
Example #13
Source File: TestingDispatcherGateway.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public TestingDispatcherGateway(
		String address,
		String hostname,
		Function<JobID, CompletableFuture<Acknowledge>> cancelJobFunction,
		Function<JobID, CompletableFuture<Acknowledge>> stopJobFunction,
		Function<JobID, CompletableFuture<ArchivedExecutionGraph>> requestJobFunction,
		Function<JobID, CompletableFuture<JobResult>> requestJobResultFunction,
		Function<JobID, CompletableFuture<JobStatus>> requestJobStatusFunction,
		Supplier<CompletableFuture<MultipleJobsDetails>> requestMultipleJobDetailsSupplier,
		Supplier<CompletableFuture<ClusterOverview>> requestClusterOverviewSupplier,
		Supplier<CompletableFuture<Collection<String>>> requestMetricQueryServicePathsSupplier,
		Supplier<CompletableFuture<Collection<Tuple2<ResourceID, String>>>> requestTaskManagerMetricQueryServicePathsSupplier,
		BiFunction<JobID, JobVertexID, CompletableFuture<OperatorBackPressureStatsResponse>> requestOperatorBackPressureStatsFunction,
		BiFunction<JobID, String, CompletableFuture<String>> triggerSavepointFunction,
		Function<JobGraph, CompletableFuture<Acknowledge>> submitFunction,
		Supplier<CompletableFuture<Collection<JobID>>> listFunction,
		int blobServerPort,
		DispatcherId fencingToken,
		Function<JobID, CompletableFuture<ArchivedExecutionGraph>> requestArchivedJobFunction) {
	super(
		address,
		hostname,
		cancelJobFunction,
		stopJobFunction,
		requestJobFunction,
		requestJobResultFunction,
		requestJobStatusFunction,
		requestMultipleJobDetailsSupplier,
		requestClusterOverviewSupplier,
		requestMetricQueryServicePathsSupplier,
		requestTaskManagerMetricQueryServicePathsSupplier,
		requestOperatorBackPressureStatsFunction,
		triggerSavepointFunction);
	this.submitFunction = submitFunction;
	this.listFunction = listFunction;
	this.blobServerPort = blobServerPort;
	this.fencingToken = fencingToken;
	this.requestArchivedJobFunction = requestArchivedJobFunction;
}
 
Example #14
Source File: TestingDispatcherGateway.java    From flink with Apache License 2.0 4 votes vote down vote up
public Builder setFencingToken(DispatcherId fencingToken) {
	this.fencingToken = fencingToken;
	return this;
}
 
Example #15
Source File: AbstractDispatcherLeaderProcess.java    From flink with Apache License 2.0 4 votes vote down vote up
DispatcherGatewayService create(
DispatcherId fencingToken,
Collection<JobGraph> recoveredJobs,
JobGraphWriter jobGraphWriter);
 
Example #16
Source File: TestingDispatcherGateway.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public DispatcherId getFencingToken() {
	return DEFAULT_FENCING_TOKEN;
}
 
Example #17
Source File: TestingDispatcherGateway.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public Builder setFencingToken(DispatcherId fencingToken) {
	this.fencingToken = fencingToken;
	return this;
}
 
Example #18
Source File: TestingDispatcherServiceFactory.java    From flink with Apache License 2.0 4 votes vote down vote up
private TestingDispatcherServiceFactory(TriFunction<DispatcherId, Collection<JobGraph>, JobGraphWriter, AbstractDispatcherLeaderProcess.DispatcherGatewayService> createFunction) {
	this.createFunction = createFunction;
}
 
Example #19
Source File: TestingDispatcherGateway.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public DispatcherId getFencingToken() {
	return DEFAULT_FENCING_TOKEN;
}
 
Example #20
Source File: TestingDispatcherServiceFactory.java    From flink with Apache License 2.0 4 votes vote down vote up
Builder setCreateFunction(TriFunction<DispatcherId, Collection<JobGraph>, JobGraphWriter, AbstractDispatcherLeaderProcess.DispatcherGatewayService> createFunction) {
	this.createFunction = createFunction;
	return this;
}
 
Example #21
Source File: DefaultDispatcherRunnerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
private TestingDispatcherGateway createDispatcherGateway(UUID leaderSessionId) {
	return new TestingDispatcherGateway.Builder()
		.setFencingToken(DispatcherId.fromUuid(leaderSessionId))
		.build();
}
 
Example #22
Source File: TestingDispatcherGateway.java    From flink with Apache License 2.0 4 votes vote down vote up
public TestingDispatcherGateway(
		String address,
		String hostname,
		Function<JobID, CompletableFuture<Acknowledge>> cancelJobFunction,
		Function<JobID, CompletableFuture<ArchivedExecutionGraph>> requestJobFunction,
		Function<JobID, CompletableFuture<JobResult>> requestJobResultFunction,
		Function<JobID, CompletableFuture<JobStatus>> requestJobStatusFunction,
		Supplier<CompletableFuture<MultipleJobsDetails>> requestMultipleJobDetailsSupplier,
		Supplier<CompletableFuture<ClusterOverview>> requestClusterOverviewSupplier,
		Supplier<CompletableFuture<Collection<String>>> requestMetricQueryServiceAddressesSupplier,
		Supplier<CompletableFuture<Collection<Tuple2<ResourceID, String>>>> requestTaskManagerMetricQueryServiceGatewaysSupplier,
		BiFunction<JobID, JobVertexID, CompletableFuture<OperatorBackPressureStatsResponse>> requestOperatorBackPressureStatsFunction,
		BiFunction<JobID, String, CompletableFuture<String>> triggerSavepointFunction,
		BiFunction<JobID, String, CompletableFuture<String>> stopWithSavepointFunction,
		Function<JobGraph, CompletableFuture<Acknowledge>> submitFunction,
		Supplier<CompletableFuture<Collection<JobID>>> listFunction,
		int blobServerPort,
		DispatcherId fencingToken,
		Function<JobID, CompletableFuture<ArchivedExecutionGraph>> requestArchivedJobFunction,
		Supplier<CompletableFuture<Acknowledge>> clusterShutdownSupplier,
		Function<ApplicationStatus, CompletableFuture<Acknowledge>> clusterShutdownWithStatusFunction,
		TriFunction<JobID, OperatorID, SerializedValue<CoordinationRequest>, CompletableFuture<CoordinationResponse>> deliverCoordinationRequestToCoordinatorFunction) {
	super(
		address,
		hostname,
		cancelJobFunction,
		requestJobFunction,
		requestJobResultFunction,
		requestJobStatusFunction,
		requestMultipleJobDetailsSupplier,
		requestClusterOverviewSupplier,
		requestMetricQueryServiceAddressesSupplier,
		requestTaskManagerMetricQueryServiceGatewaysSupplier,
		requestOperatorBackPressureStatsFunction,
		triggerSavepointFunction,
		stopWithSavepointFunction,
		clusterShutdownSupplier,
		deliverCoordinationRequestToCoordinatorFunction);
	this.submitFunction = submitFunction;
	this.listFunction = listFunction;
	this.blobServerPort = blobServerPort;
	this.fencingToken = fencingToken;
	this.requestArchivedJobFunction = requestArchivedJobFunction;
	this.clusterShutdownWithStatusFunction = clusterShutdownWithStatusFunction;
}
 
Example #23
Source File: TestingDispatcherGateway.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public DispatcherId getFencingToken() {
	return DEFAULT_FENCING_TOKEN;
}
 
Example #24
Source File: TestingDispatcherGateway.java    From flink with Apache License 2.0 4 votes vote down vote up
public Builder setFencingToken(DispatcherId fencingToken) {
	this.fencingToken = fencingToken;
	return this;
}