Skip to content

Commit 1444803

Browse files
authored
Merge pull request #391 from broadinstitute/dp-terra
add generic upload_entities_tsv task
2 parents 68e84e3 + 8265df1 commit 1444803

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

pipes/WDL/tasks/tasks_terra.wdl

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ task gcs_copy {
3030
}
3131
}
3232

33-
task upload_entities_tsv {
33+
task upload_reads_assemblies_entities_tsv {
3434
input {
3535
String workspace_name
3636
String terra_project
@@ -65,6 +65,40 @@ task upload_entities_tsv {
6565
}
6666
}
6767

68+
task upload_entities_tsv {
69+
input {
70+
String workspace_name
71+
String terra_project
72+
File tsv_file
73+
74+
String docker = "schaluvadi/pathogen-genomic-surveillance:api-wdl"
75+
}
76+
command {
77+
set -e
78+
python3<<CODE
79+
import sys
80+
from firecloud import api as fapi
81+
response = fapi.upload_entities_tsv(
82+
'~{terra_project}', '~{workspace_name}', '~{tsv_file}', model="flexible")
83+
if response.status_code != 200:
84+
print('ERROR UPLOADING: See full error message:')
85+
print(response.text)
86+
sys.exit(1)
87+
else:
88+
print("Upload complete. Check your workspace for new table!")
89+
CODE
90+
}
91+
runtime {
92+
docker: docker
93+
memory: "2 GB"
94+
cpu: 1
95+
maxRetries: 0
96+
}
97+
output {
98+
Array[String] stdout = read_lines(stdout())
99+
}
100+
}
101+
68102
task download_entities_tsv {
69103
input {
70104
String terra_project

pipes/WDL/workflows/sarscov2_illumina_full.wdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ workflow sarscov2_illumina_full {
364364
365365
# create data tables with assembly_meta_tsv if workspace name and project provided
366366
if (defined(workspace_name) && defined(terra_project)) {
367-
call terra.upload_entities_tsv as data_tables {
367+
call terra.upload_reads_assemblies_entities_tsv as data_tables {
368368
input:
369369
workspace_name = select_first([workspace_name]),
370370
terra_project = select_first([terra_project]),

pipes/WDL/workflows/terra_update_assemblies.wdl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ workflow update_data_tables {
99
email: "viral-ngs@broadinstitute.org"
1010
}
1111

12-
call terra.upload_entities_tsv
12+
call terra.upload_reads_assemblies_entities_tsv
1313

1414
output {
15-
Array[String] tables = upload_entities_tsv.tables
15+
Array[String] tables = upload_reads_assemblies_entities_tsv.tables
1616
}
1717
}

0 commit comments

Comments
 (0)