> 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.

I "remember" seeing some code by Nick that did queue a task after
catching a DeadlineExceededError but I can't find it now.  (I think
that it actually deferred, but that's the same thing if the task is
small enough.  The defer does an instance write if the task is too big
and there's not enough time to do that.)


On Dec 12, 4:23 am, Stephen <[email protected]> wrote:
> On Dec 10, 11:44 am, Alex Popescu
>
> <[email protected]> wrote:
>
> > Here is the scenario in which I'm seeing this error:
>
> > - I have a set of tasks that are executed
>
> > - the tasks are expensive so sometimes they may reach the
> > DeadlineExceededError
>
> > - in case the DeadlineExceededError occurs, I am attempting to create
> > a new task to signal that processing was not completed and should
> > continue at a later moment
>
> 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.
>
> > While I could probably code around this issue, it will definitely make
> > my app code more messy and complex. Right now things are clear:
>
> > - there is a list of objects that must be processed
>
> > - once new objects get appended to that list a new task is created for
> > taking care of them
>
> > - if the task cannot empty the list of objects to be processed it is
> > scheduling a new task to continue the processing later
>
> You could try making your batch size smaller.
>
> If a task does not return a 200 success response, it will be retried.
> You could code your task so that if it only manages to process some of
> the list, when it is run again after returning a non-200 response it
> picks up where it left off and processes the remaining items in the
> list.
>
> > Can anyone explain the meaning of the CancelledError? I read the
> > documentation and I must confess that I'm not very sure what triggers
> > it (at least I don't agree it is "explicitly").
>
> This is probably your second task being cancelled after your
> DeadlineExceededError.

--

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