Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve import error message [VS-437] #7855

Merged
merged 6 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh no that sounds super annoying!

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
}
}