On Dec 13, 1:06 am, Andy Freeman <[email protected]> wrote:
> > I don't think you can do this. When you get a DeadlineExceededError
> > you only have a very short amount of cpu time left -- enough to return
> > a simple response to the client, but not enough to queue a new task.
>
> http://code.google.com/appengine/articles/deferred.htmlcontains
> sample code that queues a task in response to a
> DeadlineExceededError .  (defer is a task queue wrapper.)
>
> Not only does this example queue a task after a DeadlineExceededError,
> it also does a db.put and a db.delete; look at _batch_write.  I'm not
> surprised that there's enough time to do queue a task but I am
> surprised that there's also enough time to do a put and a delete.


They've always been pretty vague about how long you get after a
DeadlineExceededError, which I took to mean you should finish up as
quickly as possible:

  http://code.google.com/appengine/docs/python/runtime.html#The_Request_Timer

  "The runtime environment gives the request handler a
  little bit more time (less than a second) after raising
  the exception to prepare a custom response."

I just measured it. Today, on the python runtime, you get 400ms. I
don't know if this is more or less than it used to be. Seems like it
is not guaranteed.

Anyway, regarding Alex's original question I would still try to make
my tasks robust to being run more than once, which will happen if they
fail due to DeadlineExceededError but also sometimes just because. But
I would also give them less work to do. For example, if a user uploads
an unusually large amount of work, split it and start two tasks.

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.


Reply via email to