use of org.apache.flink.runtime.rest.messages.job.savepoints.SavepointTriggerHeaders in project flink by apache.
the class RestClusterClient method triggerSavepoint.
private CompletableFuture<String> triggerSavepoint(final JobID jobId, @Nullable final String savepointDirectory, final boolean cancelJob, final SavepointFormatType formatType) {
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, formatType, null));
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();
});
}
Aggregations