rmetzger commented on a change in pull request #13655:
URL: https://github.com/apache/flink/pull/13655#discussion_r506387208



##########
File path: tools/azure-pipelines/e2e_uploading_watchdog.sh
##########
@@ -0,0 +1,67 @@
+#!/usr/bin/env bash
+# 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.
+
+# This file has the following tasks
+# a) It reads the e2e timeout from the configuration file
+# b) It prints a warning if the test has reached 80% of it's execution time
+# c) N minutes before the end of the execution time, it will start uploading 
the current output as azure artifacts
+
+COMMAND=$1
+
+HERE="`dirname \"$0\"`"             # relative
+HERE="`( cd \"$HERE\" && pwd )`"    # absolutized and normalized
+if [ -z "$HERE" ] ; then
+       exit 1
+fi
+
+OUTPUT_FILE=/tmp/_e2e_watchdog.output
+# 30 minutes for compile + 5m buffer
+START_LOG_UPLOAD_SECONDS_FROM_END=$((35*60))
+
+DEFINED_TIMEOUT_MINUTES=`cat $HERE/jobs-template.yml | grep "timeoutInMinutes" 
| tail -n 1 | cut -d ":" -f 2 | tr -d '[:space:]'`
+DEFINED_TIMEOUT_SECONDS=$(($DEFINED_TIMEOUT_MINUTES*60))
+
+echo "Running command '$COMMAND' with a timeout of $DEFINED_TIMEOUT_MINUTES 
minutes."
+
+function warning_watchdog {
+       SLEEP_TIME=$(echo "scale=0; $DEFINED_TIMEOUT_SECONDS*0.8/1" | bc)

Review comment:
       Bash doesn't support floating point math, that's why I use bc.
   doing just "$number/0.8" will return a floating point. The division and 
scale is for rounding to an integer: https://stackoverflow.com/a/20562313/568695

##########
File path: tools/azure-pipelines/e2e_uploading_watchdog.sh
##########
@@ -0,0 +1,67 @@
+#!/usr/bin/env bash
+# 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.
+
+# This file has the following tasks
+# a) It reads the e2e timeout from the configuration file
+# b) It prints a warning if the test has reached 80% of it's execution time
+# c) N minutes before the end of the execution time, it will start uploading 
the current output as azure artifacts
+
+COMMAND=$1
+
+HERE="`dirname \"$0\"`"             # relative
+HERE="`( cd \"$HERE\" && pwd )`"    # absolutized and normalized
+if [ -z "$HERE" ] ; then
+       exit 1
+fi
+
+OUTPUT_FILE=/tmp/_e2e_watchdog.output
+# 30 minutes for compile + 5m buffer
+START_LOG_UPLOAD_SECONDS_FROM_END=$((35*60))
+
+DEFINED_TIMEOUT_MINUTES=`cat $HERE/jobs-template.yml | grep "timeoutInMinutes" 
| tail -n 1 | cut -d ":" -f 2 | tr -d '[:space:]'`
+DEFINED_TIMEOUT_SECONDS=$(($DEFINED_TIMEOUT_MINUTES*60))
+
+echo "Running command '$COMMAND' with a timeout of $DEFINED_TIMEOUT_MINUTES 
minutes."
+
+function warning_watchdog {
+       SLEEP_TIME=$(echo "scale=0; $DEFINED_TIMEOUT_SECONDS*0.8/1" | bc)
+       sleep $SLEEP_TIME
+       echo 
"=========================================================================================="
+       echo "=== WARNING: This E2E Run took already 80% of the allocated time 
budget of $DEFINED_TIMEOUT_MINUTES minutes ==="
+       echo 
"=========================================================================================="
+}
+
+function log_upload_watchdog {
+       
SLEEP_TIME=$(($DEFINED_TIMEOUT_SECONDS-$START_LOG_UPLOAD_SECONDS_FROM_END))
+       sleep $SLEEP_TIME
+       echo 
"======================================================================================================="
+       echo "=== WARNING: This E2E Run will be killed in the next few minutes. 
Starting to upload the log output ==="

Review comment:
       You are right. I'll update the wording.




----------------------------------------------------------------
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


Reply via email to