use of org.apache.flink.runtime.rest.messages.job.savepoints.SavepointTriggerRequestBody 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();
});
}
use of org.apache.flink.runtime.rest.messages.job.savepoints.SavepointTriggerRequestBody in project flink by apache.
the class SavepointHandlerRequestBodyTest method testSavepointRequestCanBeParsedFromEmptyObject.
@Test
public void testSavepointRequestCanBeParsedFromEmptyObject() throws JsonProcessingException {
final SavepointTriggerRequestBody defaultParseResult = getDefaultParseResult(SavepointTriggerRequestBody.class);
assertThat(defaultParseResult.isCancelJob(), is(false));
assertThat(defaultParseResult.getTargetDirectory().isPresent(), is(false));
}
Aggregations