-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first try!!!! * prep helix for launch * add helix name fix * udpate version
- Loading branch information
1 parent
8e7bcac
commit 42ab935
Showing
6 changed files
with
169 additions
and
12 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
main: | ||
params: [args] | ||
steps: | ||
- init: | ||
assign: | ||
- projectId: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")} | ||
- region: "us-central1" | ||
- batchApi: "batch.googleapis.com/v1" | ||
- batchApiUrl: ${ "https://" + batchApi + "/projects/" + projectId + "/locations/" + region + "/jobs"} | ||
- jobId: ${ "helix-gisaid-" + string(int(sys.now()))} | ||
- newFile: ${args.data.name} | ||
- logCreateBatchJob: | ||
call: sys.log | ||
args: | ||
data: ${ "Creating and running the batch job " + jobId} | ||
- createAndRunBatchJob: | ||
call: http.post | ||
args: | ||
url: ${batchApiUrl} | ||
query: | ||
job_id: ${jobId} | ||
headers: | ||
Content-Type: application/json | ||
auth: | ||
type: OAuth2 | ||
body: | ||
taskGroups: | ||
- taskSpec: | ||
runnables: | ||
- container: | ||
imageUri: "us-docker.pkg.dev/general-theiagen/theiagen/terra-tools:2023-08-08-2" | ||
entrypoint: "/bin/bash" | ||
volumes: | ||
- "/mnt/disks/cdph_helix_gisaid_staging:/data" | ||
- "/mnt/disks/cdph_helix_gisaid_staging/.config:/.config" | ||
commands: | ||
- "-c" | ||
- ${ "bash /data/standard-dashboard.sh -d gs://cdph_helix_gisaid_staging -s no -b /data/input_gisaid -o /data -t gs://cdph_helix_gisaid -g gs://fc-6f47810a-0cc3-4e68-b8f0-12cde24d5893 -r helix_gisaid -p cdc-terrabio-taborda-manual -w dataAnalysis_SARS-CoV-2_Helix -q no -m false -i " + newFile + " -k true -x true"} | ||
volumes: | ||
- gcs: | ||
remotePath: "cdph_helix_gisaid_staging" | ||
mountPath: "/mnt/disks/cdph_helix_gisaid_staging" | ||
taskCount: 1 | ||
logsPolicy: | ||
destination: CLOUD_LOGGING | ||
result: createAndRunBatchJobResponse | ||
- getJob: | ||
call: http.get | ||
args: | ||
url: ${batchApiUrl + "/" + jobId} | ||
auth: | ||
type: OAuth2 | ||
result: getJobResult | ||
- logState: | ||
call: sys.log | ||
args: | ||
data: ${ "Current job state " + getJobResult.body.status.state} | ||
- checkState: | ||
switch: | ||
- condition: ${getJobResult.body.status.state == "SUCCEEDED"} | ||
next: returnResult | ||
- condition: ${getJobResult.body.status.state == "FAILED"} | ||
next: returnResult | ||
next: sleep | ||
- sleep: | ||
call: sys.sleep | ||
args: | ||
seconds: 10 | ||
next: getJob | ||
- returnResult: | ||
return: | ||
jobId: ${jobId} | ||
status: "OK" |
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,7 @@ | ||
gcloud eventarc triggers create helix-gisaid-trigger \ | ||
--destination-workflow=helix-gisaid \ | ||
--destination-workflow-location=us-central1 \ | ||
--event-filters="type=google.cloud.storage.object.v1.finalized" \ | ||
--event-filters="bucket=cdph_helix_gisaid" \ | ||
--location=us \ | ||
--service-account="[email protected]" |
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,2 @@ | ||
gcloud workflows deploy helix-gisaid \ | ||
--source=helix-gisaid-data-workflow.yaml |
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,34 @@ | ||
#!/bin/bash | ||
|
||
gcp_uri=$1 | ||
terra_project=$2 | ||
terra_workspace=$3 | ||
root_entity=$4 | ||
output_dir=$5 | ||
alt_delimiter=$6 | ||
|
||
date_tag=$7 | ||
set_name=${date_tag}-set | ||
|
||
# set default for $alt_delimiter in case user does not specify one | ||
if [ -z $alt_delimiter ]; then | ||
alt_delimiter="_" | ||
fi | ||
|
||
assembly_files=$(gsutil ls ${gcp_uri}/*.fasta | awk -F'/' '{ print $NF }') | ||
|
||
# make set table header | ||
echo -e "membership:${root_entity}_set_id\t${root_entity}" > ${output_dir}/${set_name}.tsv | ||
|
||
for assembly in $assembly_files; do | ||
# capture samplename from assembly filename | ||
samplename=$(echo ${assembly} | awk -F "${alt_delimiter}|.fasta" '{ print $1 }') | ||
# write samplename to the set | ||
echo -e "${set_name}\t${samplename}" >> ${output_dir}/${set_name}.tsv | ||
done | ||
|
||
# remove duplicates from tsv if samplename not unique | ||
awk '!a[$1]++' ${output_dir}/${set_name}.tsv > temp.tsv && mv temp.tsv ${output_dir}/${set_name}.tsv | ||
|
||
# Import Terra table to sepcified terra_workspace | ||
python3 /scripts/import_large_tsv/import_large_tsv.py --project ${terra_project} --workspace ${terra_workspace} --tsv ${output_dir}/${set_name}.tsv |