org.apache.flink.runtime.rest.messages.job.savepoints.SavepointTriggerHeaders Java Examples

The following examples show how to use org.apache.flink.runtime.rest.messages.job.savepoints.SavepointTriggerHeaders. 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: RestClusterClient.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private CompletableFuture<String> triggerSavepoint(
		final JobID jobId,
		final @Nullable String savepointDirectory,
		final boolean cancelJob) {
	final SavepointTriggerHeaders savepointTriggerHeaders = SavepointTriggerHeaders.getInstance();
	final SavepointTriggerMessageParameters savepointTriggerMessageParameters =
		savepointTriggerHeaders.getUnresolvedMessageParameters();
	savepointTriggerMessageParameters.jobID.resolve(jobId);

	final CompletableFuture<TriggerResponse> responseFuture = sendRequest(
		savepointTriggerHeaders,
		savepointTriggerMessageParameters,
		new SavepointTriggerRequestBody(savepointDirectory, cancelJob));

	return responseFuture.thenCompose(savepointTriggerResponseBody -> {
		final TriggerId savepointTriggerId = savepointTriggerResponseBody.getTriggerId();
		return pollSavepointAsync(jobId, savepointTriggerId);
	}).thenApply(savepointInfo -> {
		if (savepointInfo.getFailureCause() != null) {
			throw new CompletionException(savepointInfo.getFailureCause());
		}
		return savepointInfo.getLocation();
	});
}
 
Example #2
Source File: RestClusterClient.java    From flink with Apache License 2.0 6 votes vote down vote up
private CompletableFuture<String> triggerSavepoint(
		final JobID jobId,
		final @Nullable String savepointDirectory,
		final boolean cancelJob) {
	final SavepointTriggerHeaders savepointTriggerHeaders = SavepointTriggerHeaders.getInstance();
	final SavepointTriggerMessageParameters savepointTriggerMessageParameters =
		savepointTriggerHeaders.getUnresolvedMessageParameters();
	savepointTriggerMessageParameters.jobID.resolve(jobId);

	final CompletableFuture<TriggerResponse> responseFuture = sendRequest(
		savepointTriggerHeaders,
		savepointTriggerMessageParameters,
		new SavepointTriggerRequestBody(savepointDirectory, cancelJob));

	return responseFuture.thenCompose(savepointTriggerResponseBody -> {
		final TriggerId savepointTriggerId = savepointTriggerResponseBody.getTriggerId();
		return pollSavepointAsync(jobId, savepointTriggerId);
	}).thenApply(savepointInfo -> {
		if (savepointInfo.getFailureCause() != null) {
			throw new CompletionException(savepointInfo.getFailureCause());
		}
		return savepointInfo.getLocation();
	});
}
 
Example #3
Source File: RestClusterClient.java    From flink with Apache License 2.0 6 votes vote down vote up
private CompletableFuture<String> triggerSavepoint(
		final JobID jobId,
		final @Nullable String savepointDirectory,
		final boolean cancelJob) {
	final SavepointTriggerHeaders savepointTriggerHeaders = SavepointTriggerHeaders.getInstance();
	final SavepointTriggerMessageParameters savepointTriggerMessageParameters =
		savepointTriggerHeaders.getUnresolvedMessageParameters();
	savepointTriggerMessageParameters.jobID.resolve(jobId);

	final CompletableFuture<TriggerResponse> responseFuture = sendRequest(
		savepointTriggerHeaders,
		savepointTriggerMessageParameters,
		new SavepointTriggerRequestBody(savepointDirectory, cancelJob));

	return responseFuture.thenCompose(savepointTriggerResponseBody -> {
		final TriggerId savepointTriggerId = savepointTriggerResponseBody.getTriggerId();
		return pollSavepointAsync(jobId, savepointTriggerId);
	}).thenApply(savepointInfo -> {
		if (savepointInfo.getFailureCause() != null) {
			throw new CompletionException(savepointInfo.getFailureCause());
		}
		return savepointInfo.getLocation();
	});
}
 
Example #4
Source File: SavepointHandlers.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public SavepointTriggerHandler(
		final GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		final Time timeout,
		final Map<String, String> responseHeaders) {
	super(leaderRetriever, timeout, responseHeaders, SavepointTriggerHeaders.getInstance());
}
 
Example #5
Source File: RestClusterClientSavepointTriggerTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
TestSavepointTriggerHandler(final FunctionWithException<SavepointTriggerRequestBody, TriggerId, RestHandlerException> triggerHandlerLogic) {
	super(SavepointTriggerHeaders.getInstance());
	this.triggerHandlerLogic = triggerHandlerLogic;
}
 
Example #6
Source File: SavepointHandlers.java    From flink with Apache License 2.0 4 votes vote down vote up
public SavepointTriggerHandler(
		final GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		final Time timeout,
		final Map<String, String> responseHeaders) {
	super(leaderRetriever, timeout, responseHeaders, SavepointTriggerHeaders.getInstance());
}
 
Example #7
Source File: RestClusterClientSavepointTriggerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
TestSavepointTriggerHandler(final FunctionWithException<SavepointTriggerRequestBody, TriggerId, RestHandlerException> triggerHandlerLogic) {
	super(SavepointTriggerHeaders.getInstance());
	this.triggerHandlerLogic = triggerHandlerLogic;
}
 
Example #8
Source File: SavepointHandlers.java    From flink with Apache License 2.0 4 votes vote down vote up
public SavepointTriggerHandler(
		final GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		final Time timeout,
		final Map<String, String> responseHeaders) {
	super(leaderRetriever, timeout, responseHeaders, SavepointTriggerHeaders.getInstance());
}
 
Example #9
Source File: RestClusterClientSavepointTriggerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
TestSavepointTriggerHandler(final FunctionWithException<SavepointTriggerRequestBody, TriggerId, RestHandlerException> triggerHandlerLogic) {
	super(SavepointTriggerHeaders.getInstance());
	this.triggerHandlerLogic = triggerHandlerLogic;
}