Update: July 26, 2019
This section of the forum is now closed; we are working on a new support model for WDL that we will share here shortly. For Cromwell-specific issues, see the Cromwell docs and post questions on Github.

Implementing Error Handling


I have written a multistep workflow for Variant Calling using WDL and I was hoping to if i could implement error handling either in my wdl script or through cromwell. For eg. In case one of the steps in the workflow failed with an exit code, I would like to break out of the workflow at that point and hopefully write to a document the error message.


Best Answers


  • RuchiRuchi Member, Broadie, Dev admin

    Hey @ramshankar1990,

    If you're using the GATK tools inside your workflow and running on Cromwell, if a task fails, such as GenotypeGVCFs, the failure should be reported in the stderr file associated to that task and Cromwell would stop running the workflow at that point. Would that work, parsing the end of the stderr/stdout files of the task that fails?

  • Hi Ruchi! Thank you very much.

    Yes, it looks from the documentation like Cromwell will stop the workflow after failure. We generally find it useful to capture exit codes from failed tasks. so with Bash we used to use
    and then print a failure message into a single FAILURES log to be emailed to the analyst. This helps get an idea what failed before the time is spent poking through logs.

    echo date
    if [ $exitcode -ne 0 ]
    MSG="ALIGNMENT-DEDUPLICATION failed with exitcode=$exitcode for $SampleName"
    echo -e "$MSG" >> ${rootdir}/logs/mail.${analysis}.FAILURE
    exit $exitcode;

    Does Cromwell capture exit codes of the executables it runs? That would be a very useful feature for us. If not, how would you recommend we code it into the workflow ourselves? It would be good to get away from Bash ... :-)


  • Hi Ruchi,

    Thank you for your reply. I was was able to find where the information from the workflow is being written to. In the script document I noticed that the exit code is first written into a rc.tmp file and then later moved to the rc txt file. May I know why the information is being moved from the the tmp file to the txt file.

    With Regards,

Sign In or Register to comment.