GJL commented on a change in pull request #10850: [FLINK-15519][configuration] 
Preserve logs from BashJavaUtils and make them part of TM logs
URL: https://github.com/apache/flink/pull/10850#discussion_r367490800
 
 

 ##########
 File path: flink-dist/src/main/flink-bin/bin/config.sh
 ##########
 @@ -603,38 +623,32 @@ TMSlaves() {
 
 runBashJavaUtilsCmd() {
     local cmd=$1
-    local class_path=$2
-    local conf_dir=$3
-    local EXECUTION_PREFIX="BASH_JAVA_UTILS_EXEC_RESULT:"
+    local conf_dir=$2
+    local 
class_path="${3:-$FLINK_BIN_DIR/bash-java-utils.jar:`findFlinkDistJar`}"
+    class_path=`manglePathList ${class_path}`
 
-    local output=`${JAVA_RUN} -classpath ${class_path} 
org.apache.flink.runtime.util.BashJavaUtils ${cmd} --configDir ${conf_dir} | 
tail -n 1`
+    local output=`${JAVA_RUN} -classpath ${class_path} 
org.apache.flink.runtime.util.BashJavaUtils ${cmd} --configDir ${conf_dir} | 
tail -n 1000`
     if [[ $? -ne 0 ]]; then
         echo "[ERROR] Cannot run BashJavaUtils to execute command ${cmd}." 1>&2
         # Print the output in case the user redirect the log to console.
         echo $output 1>&2
         exit 1
     fi
 
-    if ! [[ $output =~ ^${EXECUTION_PREFIX}.* ]]; then
-        echo "[ERROR] Unexpected result: $output" 1>&2
+    echo "$output"
+}
+
+extractExecutionParams() {
+    local output=$1
+    local EXECUTION_PREFIX="BASH_JAVA_UTILS_EXEC_RESULT:"
+
+    local execution_config=`echo "$output" | tail -n 1`
+    if ! [[ $execution_config =~ ^${EXECUTION_PREFIX}.* ]]; then
+        echo "[ERROR] Unexpected result: $execution_config" 1>&2
         echo "[ERROR] The last line of the BashJavaUtils outputs is expected 
to be the execution result, following the prefix '${EXECUTION_PREFIX}'" 1>&2
         echo $output 1>&2
         exit 1
     fi
 
-    echo ${output} | sed "s/$EXECUTION_PREFIX//g"
-}
-
-getTmResourceJvmParams() {
-    local class_path=`constructFlinkClassPath`
-    class_path=`manglePathList ${class_path}`
-
-    runBashJavaUtilsCmd GET_TM_RESOURCE_JVM_PARAMS ${class_path} 
${FLINK_CONF_DIR}
-}
-
-getTmResourceDynamicConfigs() {
-    local class_path=`constructFlinkClassPath`
-    class_path=`manglePathList ${class_path}`
-
-    runBashJavaUtilsCmd GET_TM_RESOURCE_DYNAMIC_CONFIGS ${class_path} 
${FLINK_CONF_DIR}
+    echo ${execution_config} | sed "s/$EXECUTION_PREFIX//g"
 
 Review comment:
   I think `/g` (global replacement) is not needed

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to