org.apache.flink.runtime.rest.messages.job.savepoints.SavepointTriggerRequestBody Java Examples
The following examples show how to use
org.apache.flink.runtime.rest.messages.job.savepoints.SavepointTriggerRequestBody.
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 with Apache License 2.0 | 6 votes |
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-CEPplus with Apache License 2.0 | 6 votes |
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: SavepointHandlers.java From flink with Apache License 2.0 | 6 votes |
@Override protected CompletableFuture<String> triggerOperation(HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> request, RestfulGateway gateway) throws RestHandlerException { final JobID jobId = request.getPathParameter(JobIDPathParameter.class); final String requestedTargetDirectory = request.getRequestBody().getTargetDirectory(); if (requestedTargetDirectory == null && defaultSavepointDir == null) { throw new RestHandlerException( String.format("Config key [%s] is not set. Property [%s] must be provided.", CheckpointingOptions.SAVEPOINT_DIRECTORY.key(), SavepointTriggerRequestBody.FIELD_NAME_TARGET_DIRECTORY), HttpResponseStatus.BAD_REQUEST); } final boolean cancelJob = request.getRequestBody().isCancelJob(); final String targetDirectory = requestedTargetDirectory != null ? requestedTargetDirectory : defaultSavepointDir; return gateway.triggerSavepoint(jobId, targetDirectory, cancelJob, RpcUtils.INF_TIMEOUT); }
Example #4
Source File: SavepointHandlers.java From flink with Apache License 2.0 | 6 votes |
@Override protected CompletableFuture<String> triggerOperation(HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> request, RestfulGateway gateway) throws RestHandlerException { final JobID jobId = request.getPathParameter(JobIDPathParameter.class); final String requestedTargetDirectory = request.getRequestBody().getTargetDirectory(); if (requestedTargetDirectory == null && defaultSavepointDir == null) { throw new RestHandlerException( String.format("Config key [%s] is not set. Property [%s] must be provided.", CheckpointingOptions.SAVEPOINT_DIRECTORY.key(), SavepointTriggerRequestBody.FIELD_NAME_TARGET_DIRECTORY), HttpResponseStatus.BAD_REQUEST); } final boolean cancelJob = request.getRequestBody().isCancelJob(); final String targetDirectory = requestedTargetDirectory != null ? requestedTargetDirectory : defaultSavepointDir; return gateway.triggerSavepoint(jobId, targetDirectory, cancelJob, RpcUtils.INF_TIMEOUT); }
Example #5
Source File: RestClusterClient.java From flink with Apache License 2.0 | 6 votes |
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 #6
Source File: SavepointHandlers.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override protected CompletableFuture<String> triggerOperation(HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> request, RestfulGateway gateway) throws RestHandlerException { final JobID jobId = request.getPathParameter(JobIDPathParameter.class); final String requestedTargetDirectory = request.getRequestBody().getTargetDirectory(); if (requestedTargetDirectory == null && defaultSavepointDir == null) { throw new RestHandlerException( String.format("Config key [%s] is not set. Property [%s] must be provided.", CheckpointingOptions.SAVEPOINT_DIRECTORY.key(), SavepointTriggerRequestBody.FIELD_NAME_TARGET_DIRECTORY), HttpResponseStatus.BAD_REQUEST); } final boolean cancelJob = request.getRequestBody().isCancelJob(); final String targetDirectory = requestedTargetDirectory != null ? requestedTargetDirectory : defaultSavepointDir; return gateway.triggerSavepoint(jobId, targetDirectory, cancelJob, RpcUtils.INF_TIMEOUT); }
Example #7
Source File: SavepointHandlersTest.java From flink with Apache License 2.0 | 5 votes |
private static HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> triggerSavepointRequest( final String targetDirectory ) throws HandlerRequestException { return new HandlerRequest<>( new SavepointTriggerRequestBody(targetDirectory, false), new SavepointTriggerMessageParameters(), Collections.singletonMap(JobIDPathParameter.KEY, JOB_ID.toString()), Collections.emptyMap()); }
Example #8
Source File: RestClusterClientSavepointTriggerTest.java From flink with Apache License 2.0 | 5 votes |
@Override protected CompletableFuture<TriggerResponse> handleRequest( @Nonnull HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> request, @Nonnull DispatcherGateway gateway) throws RestHandlerException { return CompletableFuture.completedFuture(new TriggerResponse(triggerHandlerLogic.apply(request.getRequestBody()))); }
Example #9
Source File: RestClusterClientSavepointTriggerTest.java From flink with Apache License 2.0 | 5 votes |
private static RestServerEndpoint createRestServerEndpoint( final FunctionWithException<SavepointTriggerRequestBody, TriggerId, RestHandlerException> triggerHandlerLogic, final FunctionWithException<TriggerId, SavepointInfo, RestHandlerException> savepointHandlerLogic) throws Exception { return TestRestServerEndpoint.createAndStartRestServerEndpoint( restServerEndpointConfiguration, new TestSavepointTriggerHandler(triggerHandlerLogic), new TestSavepointHandler(savepointHandlerLogic)); }
Example #10
Source File: SavepointHandlersTest.java From flink with Apache License 2.0 | 5 votes |
private static HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> triggerSavepointRequest( final String targetDirectory ) throws HandlerRequestException { return new HandlerRequest<>( new SavepointTriggerRequestBody(targetDirectory, false), new SavepointTriggerMessageParameters(), Collections.singletonMap(JobIDPathParameter.KEY, JOB_ID.toString()), Collections.emptyMap()); }
Example #11
Source File: RestClusterClientSavepointTriggerTest.java From flink with Apache License 2.0 | 5 votes |
@Override protected CompletableFuture<TriggerResponse> handleRequest( @Nonnull HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> request, @Nonnull DispatcherGateway gateway) throws RestHandlerException { return CompletableFuture.completedFuture(new TriggerResponse(triggerHandlerLogic.apply(request.getRequestBody()))); }
Example #12
Source File: RestClusterClientSavepointTriggerTest.java From flink with Apache License 2.0 | 5 votes |
private static RestServerEndpoint createRestServerEndpoint( final FunctionWithException<SavepointTriggerRequestBody, TriggerId, RestHandlerException> triggerHandlerLogic, final FunctionWithException<TriggerId, SavepointInfo, RestHandlerException> savepointHandlerLogic) throws Exception { return TestRestServerEndpoint.createAndStartRestServerEndpoint( restServerEndpointConfiguration, new TestSavepointTriggerHandler(triggerHandlerLogic), new TestSavepointHandler(savepointHandlerLogic)); }
Example #13
Source File: RestClusterClientSavepointTriggerTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override protected CompletableFuture<TriggerResponse> handleRequest( @Nonnull HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> request, @Nonnull DispatcherGateway gateway) throws RestHandlerException { return CompletableFuture.completedFuture(new TriggerResponse(triggerHandlerLogic.apply(request.getRequestBody()))); }
Example #14
Source File: RestClusterClientSavepointTriggerTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private static RestServerEndpoint createRestServerEndpoint( final FunctionWithException<SavepointTriggerRequestBody, TriggerId, RestHandlerException> triggerHandlerLogic, final FunctionWithException<TriggerId, SavepointInfo, RestHandlerException> savepointHandlerLogic) throws Exception { return TestRestServerEndpoint.createAndStartRestServerEndpoint( restServerEndpointConfiguration, new TestSavepointTriggerHandler(triggerHandlerLogic), new TestSavepointHandler(savepointHandlerLogic)); }
Example #15
Source File: SavepointHandlersTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private static HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> triggerSavepointRequest( final String targetDirectory ) throws HandlerRequestException { return new HandlerRequest<>( new SavepointTriggerRequestBody(targetDirectory, false), new SavepointTriggerMessageParameters(), Collections.singletonMap(JobIDPathParameter.KEY, JOB_ID.toString()), Collections.emptyMap()); }
Example #16
Source File: SavepointHandlersTest.java From flink with Apache License 2.0 | 4 votes |
private static HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> triggerSavepointRequestWithDefaultDirectory() throws HandlerRequestException { return triggerSavepointRequest(null); }
Example #17
Source File: SavepointHandlersTest.java From flink with Apache License 2.0 | 4 votes |
private static HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> triggerSavepointRequest() throws HandlerRequestException { return triggerSavepointRequest(DEFAULT_REQUESTED_SAVEPOINT_TARGET_DIRECTORY); }
Example #18
Source File: RestClusterClientSavepointTriggerTest.java From flink with Apache License 2.0 | 4 votes |
TestSavepointTriggerHandler(final FunctionWithException<SavepointTriggerRequestBody, TriggerId, RestHandlerException> triggerHandlerLogic) { super(SavepointTriggerHeaders.getInstance()); this.triggerHandlerLogic = triggerHandlerLogic; }
Example #19
Source File: RestClusterClientSavepointTriggerTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
TestSavepointTriggerHandler(final FunctionWithException<SavepointTriggerRequestBody, TriggerId, RestHandlerException> triggerHandlerLogic) { super(SavepointTriggerHeaders.getInstance()); this.triggerHandlerLogic = triggerHandlerLogic; }
Example #20
Source File: SavepointHandlersTest.java From flink with Apache License 2.0 | 4 votes |
private static HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> triggerSavepointRequest() throws HandlerRequestException { return triggerSavepointRequest(DEFAULT_REQUESTED_SAVEPOINT_TARGET_DIRECTORY); }
Example #21
Source File: SavepointHandlersTest.java From flink with Apache License 2.0 | 4 votes |
private static HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> triggerSavepointRequestWithDefaultDirectory() throws HandlerRequestException { return triggerSavepointRequest(null); }
Example #22
Source File: SavepointHandlersTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
private static HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> triggerSavepointRequestWithDefaultDirectory() throws HandlerRequestException { return triggerSavepointRequest(null); }
Example #23
Source File: SavepointHandlersTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
private static HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> triggerSavepointRequest() throws HandlerRequestException { return triggerSavepointRequest(DEFAULT_REQUESTED_SAVEPOINT_TARGET_DIRECTORY); }
Example #24
Source File: RestClusterClientSavepointTriggerTest.java From flink with Apache License 2.0 | 4 votes |
TestSavepointTriggerHandler(final FunctionWithException<SavepointTriggerRequestBody, TriggerId, RestHandlerException> triggerHandlerLogic) { super(SavepointTriggerHeaders.getInstance()); this.triggerHandlerLogic = triggerHandlerLogic; }
Example #25
Source File: SavepointHandlers.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override protected AsynchronousJobOperationKey createOperationKey(HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> request) { final JobID jobId = request.getPathParameter(JobIDPathParameter.class); return AsynchronousJobOperationKey.of(new TriggerId(), jobId); }