Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mcovarr committed Sep 20, 2022
1 parent 6bd1706 commit 99c60af
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions scripts/variantstore/wdl/GvsCallsetStatistics.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -66,39 +66,28 @@ task CreateTables {
String aggregate_metrics_table
String statistics_table
}
meta {
# Always check that these tables exist
volatile: true
}
command <<<
set -o errexit -o nounset -o xtrace -o pipefail

set +o errexit
bq --project_id=~{project_id} show ~{dataset_name}.~{metrics_table}
BQ_SHOW_RC=$?
BQ_SHOW_METRICS=$?
set -o errexit

if [ $BQ_SHOW_RC -eq 0 ]; then
echo "Output metrics table already exists, exiting."
exit 1
fi

set +o errexit
bq --project_id=~{project_id} show ~{dataset_name}.~{aggregate_metrics_table}
BQ_SHOW_RC=$?
BQ_SHOW_METRICS_AGG=$?
set -o errexit

if [ $BQ_SHOW_RC -eq 0 ]; then
echo "Output aggregate metrics table already exists, exiting."
exit 1
fi

set +o errexit
bq --project_id=~{project_id} show ~{dataset_name}.~{statistics_table}
BQ_SHOW_RC=$?
BQ_SHOW_STATISTICS=$?
set -o errexit

if [ $BQ_SHOW_RC -eq 0 ]; then
echo "Output statistics table already exists, exiting."
exit 1
fi

# Schemas extracted programatically: https://stackoverflow.com/a/66987934
#
# After cleaning up header and quotes:
Expand Down Expand Up @@ -363,9 +352,18 @@ task CreateTables {
]
FIN
bq mk --table ~{project_id}:~{dataset_name}.~{metrics_table} metrics_schema.json
bq mk --table ~{project_id}:~{dataset_name}.~{aggregate_metrics_table} metrics_aggregate_schema.json
bq mk --table ~{project_id}:~{dataset_name}.~{statistics_table} statistics_schema.json
# Make any tables that need making
if [ $BQ_SHOW_METRICS -ne 0 ]; then
bq mk --table ~{project_id}:~{dataset_name}.~{metrics_table} metrics_schema.json
fi
if [ $BQ_SHOW_METRICS_AGG -ne 0 ]; then
bq mk --table ~{project_id}:~{dataset_name}.~{aggregate_metrics_table} metrics_aggregate_schema.json
fi
if [ $BQ_SHOW_STATISTICS -ne 0 ]; then
bq mk --table ~{project_id}:~{dataset_name}.~{statistics_table} statistics_schema.json
fi
>>>
runtime {
docker: "us.gcr.io/broad-dsde-methods/variantstore:vs_560_callset_statistics"
Expand Down

0 comments on commit 99c60af

Please sign in to comment.