Note that there are some explanatory texts on larger screens.

plurals
  1. POChannels and TaskQueues in Google App Engine (client debugging)
    text
    copied!<p>I'm trying to build and debug my first GAE application and have already benefited from the awesome support of Stackoverflowers to get where I am in having tasks being processed on the default queue. Thanks!</p> <p>However, I wanted to use Queues to demonstrate how you would do some 'long' work in the background. My idea was:</p> <ol> <li>Receive a request to process a large file. </li> <li>Store the file and enqueue a task.</li> <li>Return the response.</li> <li>Process the file on the background.</li> <li>Let the client know, via a Channel, that the work is done!</li> </ol> <p>I have all this working but for one problem. On my development server the Task Queue doesn't seem to process tasks in the background. To simulate long running work I just popped a sleep in there.</p> <pre><code>def post(self): time.sleep(60) #use a channel to let the client know we're done </code></pre> <p>It appears that the GAE development server is single threaded. It doesn't respond at all until the item has been processed off the queue? Is this assumption right? Any ideas?</p> <p>Thanks</p> <p>Adding code exanples:</p> <pre><code>#code to enqueue task taskqueue.add(url='/processSubmission', params={'key': activity.key() }, transactional=False) #class that processes queued work class ProcessSubmission(webapp.RequestHandler): def post (self): time.sleep(60) activity = db.get(db.Key(encoded=self.request.get('key'))) activity.approved = True activity.put() channel.send_message(activity.userid, 'Wahoo! we are done') </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload