Skip to content

Commit

Permalink
Merge pull request #391 from broadinstitute/dp-terra
Browse files Browse the repository at this point in the history
add generic upload_entities_tsv task
  • Loading branch information
dpark01 authored Nov 28, 2021
2 parents 68e84e3 + 8265df1 commit 1444803
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
36 changes: 35 additions & 1 deletion pipes/WDL/tasks/tasks_terra.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ task gcs_copy {
}
}

task upload_entities_tsv {
task upload_reads_assemblies_entities_tsv {
input {
String workspace_name
String terra_project
Expand Down Expand Up @@ -65,6 +65,40 @@ task upload_entities_tsv {
}
}

task upload_entities_tsv {
input {
String workspace_name
String terra_project
File tsv_file

String docker = "schaluvadi/pathogen-genomic-surveillance:api-wdl"
}
command {
set -e
python3<<CODE
import sys
from firecloud import api as fapi
response = fapi.upload_entities_tsv(
'~{terra_project}', '~{workspace_name}', '~{tsv_file}', model="flexible")
if response.status_code != 200:
print('ERROR UPLOADING: See full error message:')
print(response.text)
sys.exit(1)
else:
print("Upload complete. Check your workspace for new table!")
CODE
}
runtime {
docker: docker
memory: "2 GB"
cpu: 1
maxRetries: 0
}
output {
Array[String] stdout = read_lines(stdout())
}
}
task download_entities_tsv {
input {
String terra_project
Expand Down
2 changes: 1 addition & 1 deletion pipes/WDL/workflows/sarscov2_illumina_full.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ workflow sarscov2_illumina_full {
# create data tables with assembly_meta_tsv if workspace name and project provided
if (defined(workspace_name) && defined(terra_project)) {
call terra.upload_entities_tsv as data_tables {
call terra.upload_reads_assemblies_entities_tsv as data_tables {
input:
workspace_name = select_first([workspace_name]),
terra_project = select_first([terra_project]),
Expand Down
4 changes: 2 additions & 2 deletions pipes/WDL/workflows/terra_update_assemblies.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ workflow update_data_tables {
email: "[email protected]"
}

call terra.upload_entities_tsv
call terra.upload_reads_assemblies_entities_tsv

output {
Array[String] tables = upload_entities_tsv.tables
Array[String] tables = upload_reads_assemblies_entities_tsv.tables
}
}

0 comments on commit 1444803

Please sign in to comment.