stevenzwu commented on code in PR #20852: URL: https://github.com/apache/flink/pull/20852#discussion_r979042504
########## flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/checkpoints/CheckpointTriggerHandlers.java: ########## @@ -0,0 +1,261 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.rest.handler.job.checkpoints; + +import org.apache.flink.api.common.JobID; +import org.apache.flink.api.common.time.Time; +import org.apache.flink.runtime.dispatcher.UnknownOperationKeyException; +import org.apache.flink.runtime.rest.handler.AbstractRestHandler; +import org.apache.flink.runtime.rest.handler.HandlerRequest; +import org.apache.flink.runtime.rest.handler.RestHandlerException; +import org.apache.flink.runtime.rest.handler.async.AsynchronousOperationResult; +import org.apache.flink.runtime.rest.handler.async.TriggerResponse; +import org.apache.flink.runtime.rest.handler.job.AsynchronousJobOperationKey; +import org.apache.flink.runtime.rest.messages.EmptyRequestBody; +import org.apache.flink.runtime.rest.messages.JobIDPathParameter; +import org.apache.flink.runtime.rest.messages.TriggerId; +import org.apache.flink.runtime.rest.messages.TriggerIdPathParameter; +import org.apache.flink.runtime.rest.messages.checkpoints.CheckpointTriggerHeaders; +import org.apache.flink.runtime.rest.messages.checkpoints.CheckpointTriggerInfo; +import org.apache.flink.runtime.rest.messages.checkpoints.CheckpointTriggerMessageParameters; +import org.apache.flink.runtime.rest.messages.checkpoints.CheckpointTriggerRequestBody; +import org.apache.flink.runtime.rest.messages.checkpoints.CheckpointTriggerStatusHeaders; +import org.apache.flink.runtime.rest.messages.checkpoints.CheckpointTriggerStatusMessageParameters; +import org.apache.flink.runtime.rpc.RpcUtils; +import org.apache.flink.runtime.webmonitor.RestfulGateway; +import org.apache.flink.runtime.webmonitor.retriever.GatewayRetriever; +import org.apache.flink.util.ExceptionUtils; +import org.apache.flink.util.SerializedThrowable; + +import org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus; + +import javax.annotation.Nonnull; + +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; + +/** + * HTTP handlers for asynchronous triggering of checkpoints. + * + * <p>Drawing checkpoints is a potentially long-running operation. To avoid blocking HTTP + * connections, checkpoints must be drawn in two steps. First, an HTTP request is issued to trigger + * the checkpoint asynchronously. The request will be assigned a {@link TriggerId}, which is + * returned in the response body. Next, the returned id should be used to poll the status of the Review Comment: nit: `returned id` -> `returned {@link TriggerId}` -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
