-
Notifications
You must be signed in to change notification settings - Fork 3
/
time.sh
executable file
·30 lines (21 loc) · 1.09 KB
/
time.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
entries=("asthma,MONDO:0004979", "cystic_fibrosis,MONDO:0009061", "mvp1,MONDO:0024529", "malignant_neoplasm,MONDO:0008170")
#HOST="http://localhost:8000"
#HOST="https://cqs-dev.apps.renci.org"
HOST="https://cqs.ci.transltr.io"
for i in ${entries[@]}; do
IFS="," read disease curie <<< "${i}"
SECONDS=0
jq ".message.query_graph.nodes.n1.ids = [\"$curie\"]" sample_input_async.json > /tmp/$disease-input.json
JOB_ID=`curl -s -X POST "$HOST/asyncquery" -d @/tmp/$disease-input.json -H 'Content-Type: application/json' -H 'Accept: application/json' | jq ".job_id" | sed 's;\";;g'`
JOB_STATUS=`curl -s -X GET "$HOST/asyncquery_status/$JOB_ID" | jq ".status" | sed 's;\";;g'`
echo "$JOB_ID is $JOB_STATUS"
while [ "$JOB_STATUS" != "Completed" ]; do
sleep 10
JOB_STATUS=`curl -s -X GET "$HOST/asyncquery_status/$JOB_ID" | jq ".status" | sed 's;\";;g'`
echo "$JOB_ID is $JOB_STATUS"
done
curl -s -X GET "$HOST/download/$JOB_ID" | jq > /tmp/sample_output_$disease.pretty.json
duration=$SECONDS
echo "$((duration / 60)) minutes and $((duration % 60)) seconds elapsed."
done