Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output which scraper is run #79

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
29 changes: 21 additions & 8 deletions .deploy.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
#!/bin/bash
pipenv run scrapy list | xargs -I {} pipenv run scrapy crawl {} -s LOG_ENABLED=False &

# Output to the screen every 9 minutes to prevent a travis timeout
# https://stackoverflow.com/a/40800348
export PID=$!
while [[ `ps -p $PID | tail -n +2` ]]; do
echo 'Deploying'
sleep 30
echo "Running scrapers"
pipenv run scrapy list

# Assign variable to list of scrapers
SCRAPERS=$(pipenv run scrapy list)

# create a list of scrapers that failed
FAILED_SCRAPERS=()

# Loop through each scraper
for scraper in $SCRAPERS
do
echo "Running $scraper"
pipenv run scrapy crawl $scraper;

# check if the previous command failed and add the scraper to the list of failed scrapers
if [ $? -ne 0 ]; then
FAILED_SCRAPERS+=($scraper);
fi
done

echo "Scrapers that failed: ${FAILED_SCRAPERS[@]}"