Merge "calculate remaining timeout locally"

This commit is contained in:
Jenkins
2014-02-25 03:05:11 +00:00
committed by Gerrit Code Review
2 changed files with 16 additions and 1 deletions

View File

@@ -24,6 +24,8 @@
source $WORKSPACE/devstack-gate/functions.sh
start_timer
PROJECTS="openstack-dev/devstack $PROJECTS"
PROJECTS="openstack-dev/grenade $PROJECTS"
PROJECTS="openstack-dev/pbr $PROJECTS"
@@ -242,7 +244,8 @@ export OVERRIDE_ZUUL_BRANCH=${OVERRIDE_ZUUL_BRANCH:-$ZUUL_BRANCH}
if ! function_exists "gate_hook"; then
# the command we use to run the gate
function gate_hook {
timeout -s 9 ${DEVSTACK_GATE_TIMEOUT}m $BASE/new/devstack-gate/devstack-vm-gate.sh
remaining_time
timeout -s 9 ${REMAINING_TIME}m $BASE/new/devstack-gate/devstack-vm-gate.sh
}
fi

View File

@@ -33,6 +33,18 @@ function tsfilter {
}'
}
# create the start timer for when the job began
function start_timer {
START_TIME=`date +%s`
}
function remaining_time {
local now=`date +%s`
local elapsed=$(((now - START_TIME) / 60))
REMAINING_TIME=$((DEVSTACK_GATE_TIMEOUT - elapsed - 5))
echo "Job timeout set to: $REMAINING_TIME minutes"
}
# indent the output of a command 4 spaces, useful for distinguishing
# the output of a command from the command itself
function indent {