zentol commented on a change in pull request #8052: 
[FLINK-11458][checkpointing, rest] Add TERMINATE/SUSPEND Job with Savepoint 
(FLIP-34)
URL: https://github.com/apache/flink/pull/8052#discussion_r271696818
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/savepoints/SavepointHandlers.java
 ##########
 @@ -101,6 +104,46 @@ public SavepointHandlers(@Nullable final String 
defaultSavepointDir) {
                this.defaultSavepointDir = defaultSavepointDir;
        }
 
+       /**
+        * HTTP handler to stop a job with a savepoint.
+        */
+       public class StopWithSavepointHandler extends 
TriggerHandler<RestfulGateway, StopWithSavepointRequestBody, 
StopWithSavepointMessageParameters> {
+
+               public StopWithSavepointHandler(
+                               final GatewayRetriever<? extends 
RestfulGateway> leaderRetriever,
+                               final Time timeout,
+                               final Map<String, String> responseHeaders) {
+                       super(leaderRetriever, timeout, responseHeaders, 
StopWithSavepointTriggerHeaders.getInstance());
+               }
+
+               @Override
+               protected CompletableFuture<String> triggerOperation(
+                               final 
HandlerRequest<StopWithSavepointRequestBody, 
StopWithSavepointMessageParameters> request,
+                               final RestfulGateway gateway) throws 
RestHandlerException {
+
+                       final JobID jobId = 
request.getPathParameter(JobIDPathParameter.class);
+                       final String requestedTargetDirectory = 
request.getRequestBody().getTargetDirectory();
+
+                       if (requestedTargetDirectory == null && 
defaultSavepointDir == null) {
 
 Review comment:
   could deduplicate this block; actually the majority of this class could be 
moved into a shared `AbstractSavepointTriggerHandler` class

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to