From 3cf1208708bd475e928b070d28580403dafa5519 Mon Sep 17 00:00:00 2001 From: Ilya Shlyakhter Date: Tue, 4 Dec 2018 13:07:52 -0500 Subject: [PATCH] Set timeouts for dx jobs launched from travis-ci . (#901) Set timeouts for dx jobs launched from travis-ci. --- travis/tests-dx.sh | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/travis/tests-dx.sh b/travis/tests-dx.sh index 2a0c4134d..4e9c1089a 100755 --- a/travis/tests-dx.sh +++ b/travis/tests-dx.sh @@ -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 @@ -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 @@ -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