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


##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/trait/FlinkClientTrait.scala:
##########
@@ -376,7 +377,11 @@ trait FlinkClientTrait extends Logger {
       commandLine)
 
     val configuration =
-      applyConfiguration(submitRequest.flinkVersion.flinkHome, 
activeCommandLine, commandLine)
+      applyConfiguration(
+        submitRequest.flinkVersion.flinkHome,
+        activeCommandLine,
+        commandLine,
+        submitRequest.appName)

Review Comment:
   This needs to be replaced with submit request.effectiveAppName



##########
streampark-common/src/main/java/org/apache/streampark/common/utils/CommonUtils.java:
##########
@@ -0,0 +1,26 @@
+/*
+ * 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.common.utils;
+
+public class CommonUtils {
+  private CommonUtils() {}
+
+  public static String fixedValueBaseVar(String configValue, String jobName) {
+    return configValue.replace("${jobName}", jobName);

Review Comment:
   It is not recommended to add a method for this purpose and put it in the 
public module.



##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlinkEnv.java:
##########
@@ -115,11 +116,14 @@ public Map<String, String> convertFlinkYamlAsMap() {
   }
 
   @JsonIgnore
-  public Properties getFlinkConfig() {
+  public Properties getFlinkConfig(Application application) {
     String flinkYamlString = DeflaterUtils.unzipString(flinkConf);
     Properties flinkConfig = new Properties();
     Map<String, String> config = 
PropertiesUtils.loadFlinkConfYaml(flinkYamlString);
-    flinkConfig.putAll(config);
+    for (Map.Entry<String, String> entry : config.entrySet()) {
+      String value = CommonUtils.fixedValueBaseVar(entry.getValue(), 
application.getJobName());
+      flinkConfig.setProperty(entry.getKey(), value);

Review Comment:
   ```
   String value = entry.getValue()
               .replaceAll("\\$job(Name|name)", application.getJobName())
               .replaceAll("\\$\\{job(Name|name)}", application.getJobName())
               .replaceAll("\\$job(Id|id)", application.getId().toString())
               .replaceAll("\\$\\{job(Id|id)}", application.getId().toString());
         flinkConfig.setProperty(entry.getKey(), value);
   ```



##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/trait/FlinkClientTrait.scala:
##########
@@ -452,7 +459,7 @@ trait FlinkClientTrait extends Logger {
       key => {
         val value = flinkDefaultConfiguration.getString(key, null)
         if (value != null) {
-          configuration.setString(key, value)
+          configuration.setString(key, CommonUtils.fixedValueBaseVar(value, 
jobName))

Review Comment:
   ```
   val v = value
             .replaceAll("\\$job(Name|name)", jobName)
              .replaceAll("\\$\\{job(Name|name)}", jobName)
    configuration.setString(key, v)
   ```



-- 
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-unsubscr...@streampark.apache.org

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

Reply via email to