0

So I'm trying to test out the the task queue functionality in app engine. Essentially my setup in app engine for creating a task is:

q = taskqueue.Queue(REQUEST_QUEUE)
....
userQuery = cgi.escape(self.request.get('query'))
timeID = '%f' % time.time()
payload_str = userQuery+timeID
tasks.append(taskqueue.Task(payload = payload_str, method='PULL'))
q.add(tasks)

Then a compute engine instance will later grab a task from the queue if it exists. My problem is that when I try to add a new task through this process, even if i deleted existing tasks from the queue i get the error(I'm not naming the tasks manually):

Internal Server Error

The server has either erred or is incapable of performing the requested operation.

Traceback (most recent call last): File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in call rv = self.handle_exception(request, response, e) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in call rv = self.router.dispatch(request, response) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher return route.handler_adapter(request, response) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in call return handler.dispatch() File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch return self.handle_exception(e, self.app.debug) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch return method(*args, **kwargs) File "/base/data/home/apps/s~munnypenny-dev/1.374214486618340630/main.py", line 57, in post q.add(tasks) File >"/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/taskqueue/tas>kqueue.py", line 1924, in add return self.add_async(task, transactional).get_result() File >"/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/taskqueue/tas>kqueue.py", line 1872, in add_async rpc) File >"/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/taskqueue/tas>kqueue.py", line 1983, in __AddTasks raise BadTaskStateError('Task has already been enqueued.') BadTaskStateError: Task has already been enqueued.

Any help would be greatly appreciated.

3
  • What version of python are you using?
    – Drewness
    Mar 12, 2014 at 20:31
  • I'm using python 2.7.5.
    – jKimo
    Mar 12, 2014 at 20:36
  • 1
    Problem solved, I was just an idiot. Was not clearing my task array after the add lol
    – jKimo
    Mar 12, 2014 at 21:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.