Skip to content

Commit f2a3781

Browse files
committed
cleaned up, making it easy to switch between test and prod
1 parent 2e0af67 commit f2a3781

File tree

1 file changed

+32
-19
lines changed

1 file changed

+32
-19
lines changed

src/run_submit_clearhouse.sh

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
11
# script to run submit the clearinghouse submissions
2+
#
3+
# Peter Woollard, ENA, EMBL-EBI, March 2023
24
echo "script to run submit the clearinghouse submissions"
3-
# set environment variables and credentials up
5+
6+
##################################################################################################
7+
##### Configurable portion
8+
# set environment variables and credentials up - this is my local bash (only readable by me), suggest you doing something similar
49
source ~/.ayup
5-
url="https://www.ebi.ac.uk/ena/clearinghouse/api/curations"
6-
url="https://wwwdev.ebi.ac.uk/ena/clearinghouse/api/curations"
7-
auth_url='https://explore.api.aai.ebi.ac.uk/auth'
8-
creds=$aai_test2_creds
9-
echo $creds
10+
11+
TEST=1
12+
if [ $TEST -eq 1 ]; then
13+
echo "using test credentials and setup"
14+
url="https://wwwdev.ebi.ac.uk/ena/clearinghouse/api/curations"
15+
auth_url='https://explore.api.aai.ebi.ac.uk/auth'
16+
creds=$aai_test2_creds
17+
submission_dir="/Users/woollard/projects/bluecloud/clearinghouse/submission_data/test/splits/"
18+
submission_dir="/Users/woollard/projects/bluecloud/clearinghouse/submission_data/full/splits/"
19+
else
20+
#PROD
21+
echo "using production credentials and setup"
22+
url="https://www.ebi.ac.uk/ena/clearinghouse/api/curations"
23+
auth_url='https://api.aai.ebi.ac.uk/auth'
24+
creds=$aai_prod_creds
25+
submission_dir="/Users/woollard/projects/bluecloud/clearinghouse/submission_data/full/splits/"
26+
fi
27+
28+
# echo $creds
1029
# if meed to renew the bearer ( the below is for the test):
1130
#curl 'https://explore.api.aai.ebi.ac.uk/auth' -u $aai_test2_creds 1> bearer_file 2>/dev/null
1231
#re-running the bearerkey frequently as it times out within an hour
1332

14-
submission_dir="/Users/woollard/projects/bluecloud/clearinghouse/submission_data/full/splits/"
15-
# submission_dir="/Users/woollard/projects/bluecloud/clearinghouse/submission_data/test/splits/"
1633

17-
bearer_file="bearer_file"
34+
##################################################################################################
35+
echo "submission_dir: "$submission_dir
1836

1937
function re_run_bearer_file () {
2038
auth_url=$1
@@ -30,23 +48,19 @@ function re_run_bearer_file () {
3048
}
3149

3250
re_run_bearer_file $auth_url $creds
33-
echo $bearerkey "<<<<<<<<<<<<<<<<<<"
34-
3551
export bearerkey=`cat $bearer_file`
3652
export bearer="Authorization: Bearer $bearerkey"
3753

3854
function submit_2_clearinghouse () {
39-
4055
export curation_json_file=$1
4156
echo $curation_json_file
4257
export bearerkey=`cat $bearer_file`
4358
export bearer="Authorization: Bearer $bearerkey"
4459
#echo $bearer
45-
46-
# would not run bre
60+
# -T is needed for big files -d @ is slightly faster and puts it into memoru
4761
cmd=`echo curl -X POST \"${url}\" -H \"accept: */*\" -H \"Content-Type: application/json\" -H \"${bearer}\" -T ${curation_json_file}`
4862
cmd=`echo curl -X POST \"${url}\" -H \"accept: */*\" -H \"Content-Type: application/json\" -H \"${bearer}\" -d @${curation_json_file}`
49-
# cmd=`echo echo "ayup"`
63+
#could not get to both see the command and execute it, so doing the dirty way via a new file
5064
echo $cmd
5165
echo $cmd > run_me.sh
5266
time sh ./run_me.sh
@@ -55,15 +69,14 @@ function submit_2_clearinghouse () {
5569
}
5670

5771
for file in $submission_dir/*.json
58-
do
72+
do
5973
echo $file
6074
echo $bearer
6175
submit_2_clearinghouse $file
6276
sleep 0.1 # wait 0.1 seconds
6377
re_run_bearer_file $auth_url $creds
64-
done
65-
78+
done
6679

67-
curation_json_file="/Users/woollard/projects/bluecloud/clearinghouse/submission_data/IHO-EEZ:intersect_MARREGION.json"
80+
#end of script
6881

6982

0 commit comments

Comments
 (0)