Reputation: 1052
I'm trying task queues for the first time and while I think I have everything set up correctly, I am getting an error.
First, here is my queue.yaml file:
total_storage_limit: 500M
queue:
- name: loader
rate: 1/s
bucket_size: 1
Second, here is my code to call my task queue (it's called load.py). It needs to run every day, so I have this particular script run as a cron job.
for file in archiveList:
taskqueue.add(queue_name='loader',url='/tasks/loadworker',params = {'ID':file[:-4],'XML':str(file)})
My loadworker.py file is basically this:
class MainPage(webapp2.RequestHandler):
def post(self):
ID = self.request.get('ID')
XML = self.request.get('XML')
tmp = trialDatabase.get_or_insert(ID)
#REST OF CODE GOES BELOW
Here is the error I am seeing:
WARNING 2014-04-11 15:24:41,156 taskqueue_stub.py:1974] Task task936 failed to execute. This task will retry in 0.400 seconds
INFO 2014-04-11 15:24:41,156 module.py:627] loadandprocess: "POST /tasks/loadworker HTTP/1.1" 404 -
Off the top of my head, I'm wondering: do the task queue "caller" and the task queue "worker" need to be in the same module? I have my task queue worker in my default app.yaml file, and my loader is in the loadandprocess.yaml file. How does it work for usage, like...would each task worker call a B4 instance class as specified in my loadandprocess.yaml file?
Thanks!
Edit:
Here is the relevant part of app.yaml:
- url: /tasks/loadworker
script: loadworker.application
login: admin
Upvotes: 0
Views: 519
Reputation: 11360
Loadworker is returning a 404. A taskqueue task must return an http code 200, else it will continue to fail and retry.
Make sure loadworker returns an http response, something like:
return HttpResponse("Did it", mimetype='text/plain')
Upvotes: 2