Skip to content

Commit

Permalink
Adding region
Browse files Browse the repository at this point in the history
  • Loading branch information
anshrma committed Nov 21, 2017
1 parent cde64ac commit 1cbd943
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/queue_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
import time
import subprocess
import argparse
import os

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')
parser.add_argument('--region', dest='region',default=None, help='Region')
args = parser.parse_args()
QUEUE = args.queue
REGION = args.region

try:
if REGION is None:
REGION = os.getenv("REGION")
except:
raise "Must pass region as environment variable or argument"


sleepTime = 5
Expand Down
2 changes: 1 addition & 1 deletion templates/spotlabworker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
# echo "Debug: "$(config.py)

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

0 comments on commit 1cbd943

Please sign in to comment.