org.apache.flink.runtime.rest.messages.job.savepoints.SavepointDisposalRequest Java Examples
The following examples show how to use
org.apache.flink.runtime.rest.messages.job.savepoints.SavepointDisposalRequest.
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: SavepointDisposalHandlers.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override protected CompletableFuture<Acknowledge> triggerOperation(HandlerRequest<SavepointDisposalRequest, EmptyMessageParameters> request, RestfulGateway gateway) throws RestHandlerException { final String savepointPath = request.getRequestBody().getSavepointPath(); if (savepointPath == null) { throw new RestHandlerException( String.format("Field %s must not be omitted or be null.", SavepointDisposalRequest.FIELD_NAME_SAVEPOINT_PATH), HttpResponseStatus.BAD_REQUEST); } return gateway.disposeSavepoint(savepointPath, RpcUtils.INF_TIMEOUT); }
Example #2
Source File: RestClusterClient.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath) { final SavepointDisposalRequest savepointDisposalRequest = new SavepointDisposalRequest(savepointPath); final CompletableFuture<TriggerResponse> savepointDisposalTriggerFuture = sendRequest( SavepointDisposalTriggerHeaders.getInstance(), savepointDisposalRequest); final CompletableFuture<AsynchronousOperationInfo> savepointDisposalFuture = savepointDisposalTriggerFuture.thenCompose( (TriggerResponse triggerResponse) -> { final TriggerId triggerId = triggerResponse.getTriggerId(); final SavepointDisposalStatusHeaders savepointDisposalStatusHeaders = SavepointDisposalStatusHeaders.getInstance(); final SavepointDisposalStatusMessageParameters savepointDisposalStatusMessageParameters = savepointDisposalStatusHeaders.getUnresolvedMessageParameters(); savepointDisposalStatusMessageParameters.triggerIdPathParameter.resolve(triggerId); return pollResourceAsync( () -> sendRequest( savepointDisposalStatusHeaders, savepointDisposalStatusMessageParameters)); }); return savepointDisposalFuture.thenApply( (AsynchronousOperationInfo asynchronousOperationInfo) -> { if (asynchronousOperationInfo.getFailureCause() == null) { return Acknowledge.get(); } else { throw new CompletionException(asynchronousOperationInfo.getFailureCause()); } }); }
Example #3
Source File: SavepointDisposalHandlers.java From flink with Apache License 2.0 | 5 votes |
@Override protected CompletableFuture<Acknowledge> triggerOperation(HandlerRequest<SavepointDisposalRequest, EmptyMessageParameters> request, RestfulGateway gateway) throws RestHandlerException { final String savepointPath = request.getRequestBody().getSavepointPath(); if (savepointPath == null) { throw new RestHandlerException( String.format("Field %s must not be omitted or be null.", SavepointDisposalRequest.FIELD_NAME_SAVEPOINT_PATH), HttpResponseStatus.BAD_REQUEST); } return gateway.disposeSavepoint(savepointPath, RpcUtils.INF_TIMEOUT); }
Example #4
Source File: RestClusterClient.java From flink with Apache License 2.0 | 5 votes |
@Override public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath) { final SavepointDisposalRequest savepointDisposalRequest = new SavepointDisposalRequest(savepointPath); final CompletableFuture<TriggerResponse> savepointDisposalTriggerFuture = sendRequest( SavepointDisposalTriggerHeaders.getInstance(), savepointDisposalRequest); final CompletableFuture<AsynchronousOperationInfo> savepointDisposalFuture = savepointDisposalTriggerFuture.thenCompose( (TriggerResponse triggerResponse) -> { final TriggerId triggerId = triggerResponse.getTriggerId(); final SavepointDisposalStatusHeaders savepointDisposalStatusHeaders = SavepointDisposalStatusHeaders.getInstance(); final SavepointDisposalStatusMessageParameters savepointDisposalStatusMessageParameters = savepointDisposalStatusHeaders.getUnresolvedMessageParameters(); savepointDisposalStatusMessageParameters.triggerIdPathParameter.resolve(triggerId); return pollResourceAsync( () -> sendRequest( savepointDisposalStatusHeaders, savepointDisposalStatusMessageParameters)); }); return savepointDisposalFuture.thenApply( (AsynchronousOperationInfo asynchronousOperationInfo) -> { if (asynchronousOperationInfo.getFailureCause() == null) { return Acknowledge.get(); } else { throw new CompletionException(asynchronousOperationInfo.getFailureCause()); } }); }
Example #5
Source File: SavepointDisposalHandlers.java From flink with Apache License 2.0 | 5 votes |
@Override protected CompletableFuture<Acknowledge> triggerOperation(HandlerRequest<SavepointDisposalRequest, EmptyMessageParameters> request, RestfulGateway gateway) throws RestHandlerException { final String savepointPath = request.getRequestBody().getSavepointPath(); if (savepointPath == null) { throw new RestHandlerException( String.format("Field %s must not be omitted or be null.", SavepointDisposalRequest.FIELD_NAME_SAVEPOINT_PATH), HttpResponseStatus.BAD_REQUEST); } return gateway.disposeSavepoint(savepointPath, RpcUtils.INF_TIMEOUT); }
Example #6
Source File: RestClusterClient.java From flink with Apache License 2.0 | 5 votes |
@Override public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath) { final SavepointDisposalRequest savepointDisposalRequest = new SavepointDisposalRequest(savepointPath); final CompletableFuture<TriggerResponse> savepointDisposalTriggerFuture = sendRequest( SavepointDisposalTriggerHeaders.getInstance(), savepointDisposalRequest); final CompletableFuture<AsynchronousOperationInfo> savepointDisposalFuture = savepointDisposalTriggerFuture.thenCompose( (TriggerResponse triggerResponse) -> { final TriggerId triggerId = triggerResponse.getTriggerId(); final SavepointDisposalStatusHeaders savepointDisposalStatusHeaders = SavepointDisposalStatusHeaders.getInstance(); final SavepointDisposalStatusMessageParameters savepointDisposalStatusMessageParameters = savepointDisposalStatusHeaders.getUnresolvedMessageParameters(); savepointDisposalStatusMessageParameters.triggerIdPathParameter.resolve(triggerId); return pollResourceAsync( () -> sendRequest( savepointDisposalStatusHeaders, savepointDisposalStatusMessageParameters)); }); return savepointDisposalFuture.thenApply( (AsynchronousOperationInfo asynchronousOperationInfo) -> { if (asynchronousOperationInfo.getFailureCause() == null) { return Acknowledge.get(); } else { throw new CompletionException(asynchronousOperationInfo.getFailureCause()); } }); }
Example #7
Source File: SavepointDisposalHandlers.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override protected OperationKey createOperationKey(HandlerRequest<SavepointDisposalRequest, EmptyMessageParameters> request) { return new OperationKey(new TriggerId()); }
Example #8
Source File: RestClusterClientTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override protected CompletableFuture<TriggerResponse> handleRequest(@Nonnull HandlerRequest<SavepointDisposalRequest, EmptyMessageParameters> request, @Nonnull DispatcherGateway gateway) { assertThat(request.getRequestBody().getSavepointPath(), is(savepointPath)); return CompletableFuture.completedFuture(new TriggerResponse(triggerId)); }
Example #9
Source File: SavepointDisposalHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected OperationKey createOperationKey(HandlerRequest<SavepointDisposalRequest, EmptyMessageParameters> request) { return new OperationKey(new TriggerId()); }
Example #10
Source File: RestClusterClientTest.java From flink with Apache License 2.0 | 4 votes |
@Override protected CompletableFuture<TriggerResponse> handleRequest(@Nonnull HandlerRequest<SavepointDisposalRequest, EmptyMessageParameters> request, @Nonnull DispatcherGateway gateway) { assertThat(request.getRequestBody().getSavepointPath(), is(savepointPath)); return CompletableFuture.completedFuture(new TriggerResponse(triggerId)); }
Example #11
Source File: SavepointDisposalHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected OperationKey createOperationKey(HandlerRequest<SavepointDisposalRequest, EmptyMessageParameters> request) { return new OperationKey(new TriggerId()); }
Example #12
Source File: RestClusterClientTest.java From flink with Apache License 2.0 | 4 votes |
@Override protected CompletableFuture<TriggerResponse> handleRequest(@Nonnull HandlerRequest<SavepointDisposalRequest, EmptyMessageParameters> request, @Nonnull DispatcherGateway gateway) { assertThat(request.getRequestBody().getSavepointPath(), is(savepointPath)); return CompletableFuture.completedFuture(new TriggerResponse(triggerId)); }