Skip to content

Commit c5765bb

Browse files
committed
Cron and package updates.
1 parent 159d131 commit c5765bb

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

daily_cron.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
start=$(date +%s)
22
cd /disks/disk0/p3/production/p3-api/deployment/services/p3_api_service/app/
3-
./node_modules/pm2/bin/pm2 stop p3-index-worker
3+
4+
#
5+
# Nov 2022 - index worker started by cron
6+
# instead of doing a clean, we create the file clean_requested so that the worker cron can handle it next time around
7+
8+
#./node_modules/pm2/bin/pm2 stop p3-index-worker
9+
410
# ./node_modules/pm2/bin/pm2 reload p3-api-service
5-
./bin/p3-clean-completed
11+
#./bin/p3-clean-completed
12+
touch clean_requested
613

714
for collection in feature_sequence genome genome_amr genome_feature genome_sequence pathway subsystem sp_gene
815
do
@@ -11,7 +18,7 @@ do
1118
done
1219

1320
# restart index worker
14-
./node_modules/pm2/bin/pm2 start p3-index-worker
21+
#./node_modules/pm2/bin/pm2 start p3-index-worker
1522

1623
# print duration
1724
echo "Duration: $((($(date +%s)-$start)/60)) minutes"

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"event-stream": "^3.3.2",
3030
"express": "^4.16.3",
3131
"file-queue": "^0.2.1",
32+
"forever": "^4.0.3",
3233
"formidable": "^1.2.2",
3334
"fs-extra": "~0.12.0",
3435
"json-patch": "^0.6.1",

weekly_cron.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,23 @@ function synchronous_backup() {
99
local snapshot=$2
1010
echo "Running Backup: $collection $snapshot"
1111

12+
async_key="$collection.$snapshot.x"
1213
# fire backup call
13-
curl --silent "$SOLR_URL/admin/collections?action=BACKUP&name=$snapshot/$collection&collection=$collection&location=$BACKUP_DIR&async=$collection.$snapshot"
14+
curl --silent "$SOLR_URL/admin/collections?action=BACKUP&name=$snapshot/$collection&collection=$collection&location=$BACKUP_DIR&async=$async_key"
1415

1516
# status check
1617
STATUS="running"
1718
while [ $STATUS == "running" ]
1819
do
19-
STATUS=$(curl --silent "$SOLR_URL/admin/collections?action=REQUESTSTATUS&requestid=$collection.$snapshot&wt=json" | grep "state" | sed -e 's/[{},"]/''/g' | cut -d ':' -f 2 )
20+
STATUS=$(curl --silent "$SOLR_URL/admin/collections?action=REQUESTSTATUS&requestid=$async_key&wt=json" | grep "state" | sed -e 's/[{},"]/''/g' | cut -d ':' -f 2 )
2021
echo "[$(date '+%m/%d/%Y %H:%M:%S')] $collection $STATUS"
2122
sleep 2m
2223
done
2324
}
2425

2526
# stop indexer
2627
cd /disks/disk0/p3/production/p3-api/deployment/services/p3_api_service/app/
28+
export PATH=/disks/patric-common/runtime/node-v14.18.0/bin:$PATH
2729
./node_modules/pm2/bin/pm2 stop p3-index-worker
2830

2931
echo "# large collections in asychronous mode"
@@ -45,4 +47,4 @@ do
4547
done
4648

4749
# start indexer
48-
./node_modules/pm2/bin/pm2 start p3-index-worker
50+
# ./node_modules/pm2/bin/pm2 start p3-index-worker

0 commit comments

Comments
 (0)