use of org.apache.flink.runtime.rest.messages.JobCancellationMessageParameters in project flink by apache.
the class JobCancellationHandlerTest method testResponse.
private static void testResponse(Function<JobID, CompletableFuture<Acknowledge>> cancelJobFunction, ThrowingConsumer<CompletableFuture<EmptyResponseBody>, Exception> assertion) throws Exception {
final RestfulGateway gateway = createGateway(cancelJobFunction);
final JobCancellationHandler jobCancellationHandler = createHandler(gateway);
final JobCancellationMessageParameters messageParameters = jobCancellationHandler.getMessageHeaders().getUnresolvedMessageParameters().resolveJobId(new JobID());
final CompletableFuture<EmptyResponseBody> cancellationFuture = jobCancellationHandler.handleRequest(HandlerRequest.create(EmptyRequestBody.getInstance(), messageParameters), gateway);
assertion.accept(cancellationFuture);
}
use of org.apache.flink.runtime.rest.messages.JobCancellationMessageParameters in project flink by apache.
the class RestClusterClient method cancel.
@Override
public CompletableFuture<Acknowledge> cancel(JobID jobID) {
JobCancellationMessageParameters params = new JobCancellationMessageParameters().resolveJobId(jobID).resolveTerminationMode(TerminationModeQueryParameter.TerminationMode.CANCEL);
CompletableFuture<EmptyResponseBody> responseFuture = sendRequest(JobCancellationHeaders.getInstance(), params);
return responseFuture.thenApply(ignore -> Acknowledge.get());
}
Aggregations