I have a sqs queue with name "testqueue", and I have this createjob()
function to upload an input file a mapper and reducer file to an s3 bucket.
And then i call enqueuejob()
function to enqueue a mapreduce job request to my sqs queue.
But its not working when I call my function createjob() my SQS queue is not receveing nothing. Do you see why?
#!/usr/bin/env python
import boto
from boto.sqs.connection import SQSConnection
import boto.sqs
import cPickle
from boto.sqs.message import Message
conn_s3 = boto.connect_s3()
def enqueuejob(datafile,mapper,reducer):
conn_sqs = SQSConnection()
queuename = 'testqueue'
q = conn_sqs.get_all_queues(prefix=queuename)
msgdict = {'datafile': datafile, 'mapper': mapper, 'reducer':reducer}
msg = cPickle.dumps(msgdict)
m = Message()
m.set_body(msg)
def createjob():
bucket = conn_s3.get_bucket('myFolder')
key_mapper = bucket.new_key('mapper.py')
key_reducer = bucket.new_key('reducer.py')
key_input = bucket.new_key('teste.txt')
key_mapper.set_contents_from_filename('mapper.py')
key_reducer.set_contents_from_filename('reducer.py')
key_input.set_contents_from_filename('teste.txt')
enqueuejob(key_input,key_mapper,key_reducer)
createjob()
Aucun commentaire:
Enregistrer un commentaire