1996fanrui commented on code in PR #2268:
URL:
https://github.com/apache/incubator-streampark/pull/2268#discussion_r1103619008
##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/FlinkClientHandler.scala:
##########
@@ -36,6 +36,19 @@ object FlinkClientHandler {
}
}
+ def triggerSavepoint(savepointRequest: TriggerSavepointRequest):
SavepointResponse = {
+ savepointRequest.executionMode match {
+ case ExecutionMode.LOCAL =>
LocalSubmit.triggerSavepoint(savepointRequest)
+ case ExecutionMode.REMOTE =>
RemoteSubmit.triggerSavepoint(savepointRequest)
+ case ExecutionMode.YARN_APPLICATION =>
YarnApplicationSubmit.triggerSavepoint(savepointRequest)
+ case ExecutionMode.YARN_SESSION =>
YarnSessionSubmit.triggerSavepoint(savepointRequest)
+ case ExecutionMode.YARN_PER_JOB | ExecutionMode.YARN_SESSION =>
YarnPerJobSubmit.triggerSavepoint(savepointRequest)
+ case ExecutionMode.KUBERNETES_NATIVE_SESSION =>
KubernetesNativeSessionSubmit.triggerSavepoint(savepointRequest)
+ case ExecutionMode.KUBERNETES_NATIVE_APPLICATION =>
KubernetesNativeApplicationSubmit.triggerSavepoint(savepointRequest)
+ case _ => throw new UnsupportedOperationException(s"Unsupported
${savepointRequest.executionMode} Submit ")
+ }
+ }
+
Review Comment:
Hi @RocMarshal , `FlinkClientHandler` is a bad case for code design, it has
too many `match ... case `.
It can be refactored after this PR, would you like to work on it?
cc @wolfboys
##########
streampark-flink/streampark-flink-client/streampark-flink-client-api/src/main/scala/org/apache/streampark/flink/client/bean/SavepointRequestTrait.scala:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.streampark.flink.client.bean
+
+import java.util.{Map => JavaMap}
+
+import org.apache.streampark.common.conf.{FlinkVersion, K8sFlinkConfig}
+import org.apache.streampark.common.enums.ExecutionMode
+
+import javax.annotation.Nullable
+
+trait SavepointRequestTrait {
Review Comment:
Should some common fields be defined inside the trait instead of sub-class?
such as: flink version, jobId, etc.
##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/CheckpointProcessor.java:
##########
@@ -41,9 +44,16 @@
@Component
public class CheckpointProcessor {
+ private static final Byte DEFAULT_FLAG_BYTE = Byte.valueOf("0");
+ private static final Integer SAVEPOINT_CACHE_HOUR = 1;
+
private final Cache<String, Long> checkPointCache =
Caffeine.newBuilder().expireAfterAccess(1, TimeUnit.DAYS).build();
+ /** Cache to store the savepoint path if be stored in the db. */
+ private final Cache<String, Byte> savepointedCache =
Review Comment:
Why need the `savepointedCache`? Why `checkPointCache` isn't enough?
--
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]