Skip to content

Commit

Permalink
Script to execute the main process and some other adapters sequentially
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Aug 24, 2021
1 parent e22764e commit 694a641
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ COPY sources /app/sources/
COPY adapters /app/adapters/
COPY migrations /app/migrations/
COPY index.sh /app/
COPY index.adapter.sh /app/

#############################
# entrypoint
#
Expand Down
11 changes: 11 additions & 0 deletions index.adapter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# !/usr/bin/env bash
# Script to fetch data adapter by adapter
adapters=adapters.list
for file in ./sources/*.json; do
jq '.[] | select(.active == true ).name' $file | sed -r 's/^"|"$//g' >>$adapters
done

while read adapter; do
echo "================================> $adapter <================================"
node index.js --source "$adapter" -b
done <$adapters
14 changes: 6 additions & 8 deletions index.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# !/usr/bin/env bash
adapters=adapters.list
for file in ./sources/*.json; do
jq '.[] | select(.active == true ).name' $file | sed -r 's/^"|"$//g' >>$adapters
done
# This script intends to run the main fetch data process and other processes sequentially.
# The script also has a timeout to kill the process in case it gets stuck.
echo "Start main fetch process"
timeout 5m npm start

while read adapter; do
echo "================================> $adapter <================================"
node index.js --source "$adapter" -b
done <$adapters
echo "Start ccmaq - indian adapter"
timeout 20m node index.js --source="caaqm"

0 comments on commit 694a641

Please sign in to comment.