Skip to content

Commit

Permalink
Improve import error message [VS-437] (#7855)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcovarr authored May 18, 2022
1 parent 7388851 commit 6767947
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 21 deletions.
27 changes: 6 additions & 21 deletions scripts/variantstore/wdl/GvsImportGenomes.wdl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
version 1.0

import "GvsUtils.wdl" as GvsUtils

workflow GvsImportGenomes {

input {
Expand All @@ -22,9 +24,11 @@ workflow GvsImportGenomes {
Int input_length = length(input_vcfs)
Int input_indexes_length = length(input_vcf_indexes)
if ((input_length != length(external_sample_names)) || (input_indexes_length != length(external_sample_names))) {
call TerminateWorkflow {
call GvsUtils.TerminateWorkflow {
input:
message = "The number of external_sample_names, sample input_vcfs and sample input_vcf_indexes are not the same."
message = "The lengths of workflow inputs `external_sample_names` (" + length(external_sample_names) +
"), `input_vcfs` (" + input_length + ") and `input_vcf_indexes` (" + input_indexes_length + ") should be the same.\n\n" +
"If any of these counts are zero an incorrect or non-existent attribute may have been referenced."
}
}

Expand Down Expand Up @@ -295,25 +299,6 @@ task LoadData {



task TerminateWorkflow {
input {
String message
}

command <<<
set -e
echo ~{message}
exit 1
>>>
runtime {
docker: "python:3.8-slim-buster"
memory: "1 GB"
disks: "local-disk 10 HDD"
preemptible: 3
cpu: 1
}
}

task SetIsLoadedColumn {
meta {
volatile: true
Expand Down
28 changes: 28 additions & 0 deletions scripts/variantstore/wdl/GvsUtils.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,31 @@ task BuildGATKJarAndCreateDataset {
disks: "local-disk 500 HDD"
}
}


task TerminateWorkflow {
input {
String message
}

command <<<
set -o errexit

# To avoid issues with special characters within the message, write the message to a file.
cat > message.txt <<FIN
~{message}
FIN
# cat the file to stderr as this task is going to fail due to the exit 1.
cat message.txt >&2
exit 1
>>>
runtime {
docker: "python:3.8-slim-buster"
memory: "1 GB"
disks: "local-disk 10 HDD"
preemptible: 3
cpu: 1
}
}

0 comments on commit 6767947

Please sign in to comment.