Skip to content

Commit

Permalink
Fetching the queue name and parameters from within the script without…
Browse files Browse the repository at this point in the history
… external dependencies
  • Loading branch information
anshrma committed Nov 21, 2017
1 parent 0007261 commit cde64ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 8 additions & 3 deletions src/queue_processor.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import boto3
import time
import subprocess
import config
import argparse

session = boto3.session.Session()
REGION = session.region_name
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--queue', dest='queue',default='workshop', help='Amazon SQS')
args = parser.parse_args()
QUEUE = args.queue

REGION = str(config.REGION)
QUEUE = str(config.QUEUE)

sleepTime = 5

Expand Down
8 changes: 4 additions & 4 deletions templates/spotlabworker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
wget $WEBURL/static/queue_processor.py
wget $WEBURL/static/worker.py

echo "Configuring worker inputs"
echo "QUEUE = 'Workshop'" > config.py
echo "REGION = '$REGION'" >> config.py
echo "Debug: "$(config.py)
# echo "Configuring worker inputs"
# echo "QUEUE = 'Workshop'" > config.py
# echo "REGION = '$REGION'" >> config.py
# echo "Debug: "$(config.py)

echo 'Starting the worker processor'
python /home/ec2-user/spotlabworker/queue_processor.py > stdout.txt 2>&1

0 comments on commit cde64ac

Please sign in to comment.