Skip to content

Commit

Permalink
Set timeouts for dx jobs launched from travis-ci . (#901)
Browse files Browse the repository at this point in the history
Set timeouts for dx jobs launched from travis-ci.
  • Loading branch information
notestaff authored Dec 4, 2018
1 parent d0c7d4d commit 3cf1208
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions travis/tests-dx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,28 @@ if [ ! -f $COMPILE_SUCCESS ]; then
dx download --no-progress /build/$VERSION/$COMPILE_SUCCESS
fi

function dx_run_timeout_args {
#
# Construct command-line arguments for 'dx run' command
# to set a timeout on the applets it runs
#

local dx_workflow_id="$1"
local dx_extra_applet_id="$2"

local dx_workflow_applet_ids=$(dx describe $dx_workflow_id | grep applet- | awk '{print $2;}')
local dx_applet_ids="$dx_workflow_applet_ids $dx_extra_applet_id"
local comma=""
local timeout_args="{\"timeoutPolicyByExecutable\":{"
for dx_applet_id in $dx_applet_ids
do
timeout_args="${timeout_args}${comma}\"$dx_applet_id\":{\"*\":{\"hours\":3}}"
comma=","
done
timeout_args="$timeout_args}}"
echo $timeout_args
}

TEST_LAUNCH_ALL="dxWDL-execute_all-launched.txt"
touch $TEST_LAUNCH_ALL
for workflow in pipes/WDL/workflows/*.wdl; do
Expand All @@ -27,11 +49,14 @@ for workflow in pipes/WDL/workflows/*.wdl; do
if [ -f $input_json ]; then
# launch simple test cases on DNAnexus CI project
dx_workflow_id=$(grep -w "^$workflow_name" $COMPILE_SUCCESS | cut -f 2)
timeout_args=$(dx_run_timeout_args $dx_workflow_id)
dx_job_id=$(dx run \
$dx_workflow_id -y --brief \
-f $input_json \
--name "$VERSION $workflow_name" \
--destination /tests/$VERSION/$workflow_name)
--destination /tests/$VERSION/$workflow_name \
--extra-args $timeout_args \
)
if [ $? -eq 0 ]; then
echo "Launched $workflow_name as $dx_job_id"
else
Expand All @@ -46,11 +71,15 @@ done
# Special case: run test for the demux_launcher native applet (which invokes
# the demux_plus WDL workflow)
demux_launcher_id=$(grep demux_launcher $COMPILE_SUCCESS | cut -f 2)
demux_plus_workflow_id=$(grep demux_plus $COMPILE_SUCCESS | cut -f 2)
timeout_args=$(dx_run_timeout_args $demux_plus_workflow_id $demux_launcher_id)
dx_job_id=$(dx run \
$demux_launcher_id -y --brief \
-i upload_sentinel_record=record-Bv8qkgQ0jy198GK0QVz2PV8Y \
--name "$VERSION demux_launcher" \
-i folder=/tests/$VERSION/demux_launcher)
-i folder=/tests/$VERSION/demux_launcher \
--extra-args $timeout_args \
)
echo "Launched demux_launcher as $dx_job_id"
echo -e "demux_launcher\t$demux_launcher_id\t$dx_job_id" >> $TEST_LAUNCH_ALL

Expand Down

0 comments on commit 3cf1208

Please sign in to comment.