XComp commented on a change in pull request #13260:
URL: https://github.com/apache/flink/pull/13260#discussion_r478365211



##########
File path: tools/ci/test_controller.sh
##########
@@ -69,6 +69,10 @@ export JAVA_TOOL_OPTIONS="-XX:+HeapDumpOnOutOfMemoryError"
 # some tests provide additional logs if they find this variable
 export IS_CI=true
 
+export WATCHDOG_ADDITIONAL_MONITORING_FILES="$DEBUG_FILES_OUTPUT_DIR/mvn-*.log"

Review comment:
       Wouldn't it be better to pass this variable as a parameter to `source 
"${HERE}/watchdog.sh"`? Of course, we would have to handle the variable in 
`watchdog.sh` properly, then, since it has to be accessed through `$1`. The 
variable `$WATCHDOG_ADDITIONAL_MONITORING_FILES` is nowhere else used.

##########
File path: tools/ci/watchdog.sh
##########
@@ -38,8 +38,26 @@ CMD_EXIT="/tmp/watchdog.exit"
 # Utility functions
 # ============================================= 
 
+max_of() {
+  local max number
+
+  max="$1"
+
+  for number in "${@:2}"; do
+    if ((number > max)); then
+      max="$number"
+    fi
+  done
+
+  printf '%d\n' "$max"
+}
+
+# Returns the highest modification time out of $CMD_OUT (which is the command 
output file)
+# and any file(s) named "mvn-*.log" (which are logging files created by 
Flink's tests)
 mod_time () {
-       echo `stat -c "%Y" $CMD_OUT`
+       CMD_OUT_MOD_TIME=`stat -c "%Y" $CMD_OUT`
+       ADDITIONAL_FILES_MOD_TIMES=`stat -c "%Y" 
$WATCHDOG_ADDITIONAL_MONITORING_FILES 2> /dev/null`
+       echo `max_of $CMD_OUT_MOD_TIME $ADDITIONAL_FILES_MOD_TIMES`

Review comment:
       It looks alright. FYI: The following one-liner should do the same:
   ```
   mod_time() {
     stat -c "%Y" "$CMD_OUT $WATCHDOG_ADDITIONAL_MONITORING_FILES" | sort -nr | 
head -1
   }
   ```




----------------------------------------------------------------
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:
[email protected]


Reply via email to