-
Notifications
You must be signed in to change notification settings - Fork 596
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
Ingest Error Handling Fixes [VS-261] #7841
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
version 1.0 | ||
|
||
import "GvsAssignIds.wdl" as GvsAssignIds | ||
import "GvsImportGenomes.wdl" as GvsImportGenomes | ||
import "GvsUtils.wdl" as GvsUtils | ||
|
||
workflow GvsIngestTieout { | ||
input { | ||
String project | ||
String reference_dataset_name | ||
String branch_name | ||
Array[String] sample_names | ||
Array[File] input_vcfs | ||
Array[File] input_vcf_indexes | ||
String? service_account_json_path | ||
} | ||
|
||
call GvsUtils.BuildGATKJarAndCreateDataset { | ||
input: | ||
branch_name = branch_name, | ||
dataset_prefix = "ingest_tieout" | ||
} | ||
|
||
call GvsAssignIds.GvsAssignIds { | ||
input: | ||
project_id = project, | ||
dataset_name = BuildGATKJarAndCreateDataset.dataset_name, | ||
external_sample_names = sample_names, | ||
assign_ids_gatk_override = BuildGATKJarAndCreateDataset.jar, | ||
service_account_json_path = service_account_json_path | ||
} | ||
|
||
call GvsImportGenomes.GvsImportGenomes { | ||
input: | ||
go = GvsAssignIds.done, | ||
dataset_name = BuildGATKJarAndCreateDataset.dataset_name, | ||
project_id = project, | ||
external_sample_names = sample_names, | ||
input_vcfs = input_vcfs, | ||
input_vcf_indexes = input_vcf_indexes, | ||
load_data_gatk_override = BuildGATKJarAndCreateDataset.jar, | ||
service_account_json_path = service_account_json_path | ||
} | ||
|
||
call IngestTieout { | ||
input: | ||
dataset_name = BuildGATKJarAndCreateDataset.dataset_name, | ||
reference_dataset_name = reference_dataset_name, | ||
project = project, | ||
stderrs = GvsImportGenomes.load_data_stderrs | ||
} | ||
} | ||
|
||
|
||
task IngestTieout { | ||
input { | ||
Boolean? go | ||
String dataset_name | ||
String reference_dataset_name | ||
String project | ||
Array[File] stderrs | ||
} | ||
|
||
parameter_meta { | ||
stderrs: { | ||
localization_optional: true | ||
} | ||
} | ||
|
||
command <<< | ||
set -o xtrace | ||
fail=0 | ||
|
||
check_table() { | ||
local table_name=$1 | ||
|
||
bq query --location=US --project_id=~{project} --format=csv --use_legacy_sql=false \ | ||
"select actual.sample_id, expected.sample_id from | ||
(select sample_id, count(*) as count from \`spec-ops-aou.~{dataset_name}.${table_name}\` group by sample_id) actual full outer join | ||
(select sample_id, count(*) as count from \`spec-ops-aou.~{reference_dataset_name}.${table_name}\` group by sample_id) expected on actual.sample_id = expected.sample_id | ||
where actual.count != expected.count OR actual.sample_id is null OR expected.sample_id is null" > differences.txt | ||
|
||
if [[ -s differences.txt ]]; then | ||
fail=1 | ||
echo "${table_name} row counts are mismatched for the following samples:" | ||
cat differences.txt | ||
fi | ||
} | ||
|
||
# This task is currently being called with a sample set of 2000 so it only needs to check a single vet and | ||
# ref_ranges table each. If this code were to be called with a sample set of more than 4000 it should test all | ||
# the additional vet and ref_ranges tables that would be introduced. | ||
if [[ ~{length(stderrs)} -gt 4000 ]]; then | ||
echo "IngestTieout invoked with a sample set of size ~{length(stderrs)} but is currently limited to sample sets no larger than 4000." | ||
exit 1 | ||
fi | ||
|
||
check_table "ref_ranges_001" | ||
check_table "vet_001" | ||
|
||
mkdir logs | ||
cd logs | ||
|
||
# Get everything up to and including the /call-LoadData/ part of the GCS path. | ||
gcs_prefix=$(echo ~{stderrs[0]} | sed -E 's!(.*/call-LoadData/).*!\1!') | ||
|
||
# Recursively copy everything under this path. | ||
gsutil -m cp -r ${gcs_prefix} . | ||
|
||
# Find the stderr files in the call execution directories but not the ones in the pipelines-logs directories. | ||
find call-LoadData -name pipelines-logs -prune -o -name stderr -print > stderr_fofn.txt | ||
echo "Found $(wc -l stderr_fofn.txt | awk '{print $1}') stderr files in call directories" | ||
|
||
cat stderr_fofn.txt | xargs grep StatusRuntimeException | tee exceptions.txt | ||
if [[ $? -ne 0 ]]; then | ||
fail=1 | ||
echo "Did not find any StatusRuntimeExceptions among the stderr files!" | ||
else | ||
grep UNAVAILABLE exceptions.txt | ||
if [[ $? -ne 0 ]]; then | ||
fail=1 | ||
echo "No UNAVAILABLE StatusRuntimeExceptions found for run!" | ||
fi | ||
grep -E 'ABORTED|INTERNAL|CANCELLED' exceptions.txt | ||
if [[ $? -ne 0 ]]; then | ||
fail=1 | ||
echo "No retryable StatusRuntimeExceptions (ABORTED, INTERNAL, CANCELLED) found for run!" | ||
fi | ||
fi | ||
|
||
cd .. | ||
|
||
if [[ $fail -ne 0 ]]; then | ||
exit 1; | ||
fi | ||
>>> | ||
|
||
output { | ||
File stderr_fofn = "logs/stderr_fofn.txt" | ||
File exceptions = "logs/exceptions.txt" | ||
Boolean done = true | ||
} | ||
|
||
runtime { | ||
docker: "gcr.io/google.com/cloudsdktool/cloud-sdk:latest" | ||
memory: "14 GB" | ||
disks: "local-disk 2000 HDD" | ||
preemptible: 3 | ||
cpu: 4 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is almost completely a cut/paste of a task from the quickstart integration test to
GvsUtils.wdl
so it could be reused.