You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by "wolfboys (via GitHub)" <gi...@apache.org> on 2023/08/29 05:07:44 UTC

[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #2994: Refactor the lifecycle control of flink application mode -dosubmit

wolfboys commented on code in PR #2994:
URL: https://github.com/apache/incubator-streampark/pull/2994#discussion_r1308200604


##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/impl/KubernetesNativeApplicationClient.scala:
##########
@@ -103,4 +109,37 @@ object KubernetesNativeApplicationClient extends KubernetesNativeClientTrait {
     flinkConf.safeSet(DeploymentOptions.TARGET, ExecutionMode.KUBERNETES_NATIVE_APPLICATION.getName)
     super.doTriggerSavepoint(request, flinkConf)
   }
+
+  def convertFlinkDeploymentDef(
+      submitRequest: SubmitRequest,
+      flinkConfig: Configuration): FlinkDeploymentDef = {
+    val spec = FlinkDeploymentDef(
+      name = submitRequest.appName,
+      namespace = submitRequest.k8sSubmitParam.kubernetesNamespace,
+      image = "flink:" + submitRequest.flinkVersion.majorVersion,
+      flinkVersion = converFlinkVersion(submitRequest.flinkVersion.majorVersion),
+      jobManager =
+        JobManagerDef(cpu = 1, memory = flinkConfig.toMap.get("taskmanager.memory.process.size")),

Review Comment:
   flinkConfig.get(JobManagerOptions.TOTAL_PROCESS_MEMORY)



##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/impl/KubernetesNativeApplicationClient.scala:
##########
@@ -103,4 +109,37 @@ object KubernetesNativeApplicationClient extends KubernetesNativeClientTrait {
     flinkConf.safeSet(DeploymentOptions.TARGET, ExecutionMode.KUBERNETES_NATIVE_APPLICATION.getName)
     super.doTriggerSavepoint(request, flinkConf)
   }
+
+  def convertFlinkDeploymentDef(

Review Comment:
   private[this] def convertFlinkDeploymentDef ...



##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/impl/KubernetesNativeApplicationClient.scala:
##########
@@ -103,4 +109,37 @@ object KubernetesNativeApplicationClient extends KubernetesNativeClientTrait {
     flinkConf.safeSet(DeploymentOptions.TARGET, ExecutionMode.KUBERNETES_NATIVE_APPLICATION.getName)
     super.doTriggerSavepoint(request, flinkConf)
   }
+
+  def convertFlinkDeploymentDef(
+      submitRequest: SubmitRequest,
+      flinkConfig: Configuration): FlinkDeploymentDef = {
+    val spec = FlinkDeploymentDef(
+      name = submitRequest.appName,
+      namespace = submitRequest.k8sSubmitParam.kubernetesNamespace,
+      image = "flink:" + submitRequest.flinkVersion.majorVersion,
+      flinkVersion = converFlinkVersion(submitRequest.flinkVersion.majorVersion),
+      jobManager =
+        JobManagerDef(cpu = 1, memory = flinkConfig.toMap.get("taskmanager.memory.process.size")),
+      taskManager =
+        TaskManagerDef(cpu = 1, memory = flinkConfig.toMap.get("jobmanager.memory.process.size")),
+      job = Some(
+        JobDef(
+          jarURI =
+            submitRequest.buildResult.asInstanceOf[DockerImageBuildResponse].dockerInnerMainJarPath,
+            parallelism = submitRequest.properties.get("parallelism.default").asInstanceOf[Int]
+        ))
+    )
+    spec
+  }
+
+  def converFlinkVersion(version: String): FlinkVersion = {
+    version match {
+      case "1.17" => FlinkVersion.V1_17
+      case "1.16" => FlinkVersion.V1_16
+      case "1.15" => FlinkVersion.V1_15
+      case "1.14" => FlinkVersion.V1_14
+      case "1.13" => FlinkVersion.V1_13
+      case _ => null

Review Comment:
   Do we need to throw an exception?



##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/impl/KubernetesNativeApplicationClient.scala:
##########
@@ -103,4 +109,37 @@ object KubernetesNativeApplicationClient extends KubernetesNativeClientTrait {
     flinkConf.safeSet(DeploymentOptions.TARGET, ExecutionMode.KUBERNETES_NATIVE_APPLICATION.getName)
     super.doTriggerSavepoint(request, flinkConf)
   }
+
+  def convertFlinkDeploymentDef(
+      submitRequest: SubmitRequest,
+      flinkConfig: Configuration): FlinkDeploymentDef = {
+    val spec = FlinkDeploymentDef(
+      name = submitRequest.appName,
+      namespace = submitRequest.k8sSubmitParam.kubernetesNamespace,
+      image = "flink:" + submitRequest.flinkVersion.majorVersion,
+      flinkVersion = converFlinkVersion(submitRequest.flinkVersion.majorVersion),
+      jobManager =
+        JobManagerDef(cpu = 1, memory = flinkConfig.toMap.get("taskmanager.memory.process.size")),
+      taskManager =
+        TaskManagerDef(cpu = 1, memory = flinkConfig.toMap.get("jobmanager.memory.process.size")),
+      job = Some(
+        JobDef(
+          jarURI =
+            submitRequest.buildResult.asInstanceOf[DockerImageBuildResponse].dockerInnerMainJarPath,
+            parallelism = submitRequest.properties.get("parallelism.default").asInstanceOf[Int]
+        ))
+    )
+    spec
+  }
+
+  def converFlinkVersion(version: String): FlinkVersion = {

Review Comment:
   private[this] def converFlinkVersion ....



##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/impl/KubernetesNativeApplicationClient.scala:
##########
@@ -103,4 +109,37 @@ object KubernetesNativeApplicationClient extends KubernetesNativeClientTrait {
     flinkConf.safeSet(DeploymentOptions.TARGET, ExecutionMode.KUBERNETES_NATIVE_APPLICATION.getName)
     super.doTriggerSavepoint(request, flinkConf)
   }
+
+  def convertFlinkDeploymentDef(
+      submitRequest: SubmitRequest,
+      flinkConfig: Configuration): FlinkDeploymentDef = {
+    val spec = FlinkDeploymentDef(
+      name = submitRequest.appName,
+      namespace = submitRequest.k8sSubmitParam.kubernetesNamespace,
+      image = "flink:" + submitRequest.flinkVersion.majorVersion,
+      flinkVersion = converFlinkVersion(submitRequest.flinkVersion.majorVersion),
+      jobManager =
+        JobManagerDef(cpu = 1, memory = flinkConfig.toMap.get("taskmanager.memory.process.size")),
+      taskManager =
+        TaskManagerDef(cpu = 1, memory = flinkConfig.toMap.get("jobmanager.memory.process.size")),

Review Comment:
   flinkConfig.get(TaskManagerOptions.TOTAL_PROCESS_MEMORY)



-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org