Found my problem.  Looks like I must execute that appcfg.py update backends
command each time I make a code change.  It seems obvious now, but of
course, it never occurred to me!  I'm all good now, even with countdown set
to 0, and tasqueue target set to either instance.backend_name or just
backend_name.

It also might seem silly that I'm making my backend queue up requests for
itself (in an attempt to break up requests), when in fact it could process
the whole big request inline in one shot.  But its actually common code that
might also get executed by a front-end in some circumstances.  I should look
into a run-time condition that I can use to determine whether I'm in the
context of a front-end or a backend, and queue up requests to myself only
for front-end instances.  Do you know if there's a way to do that?

Thanks for your help!

Regards
-Rishi


On Fri, Sep 9, 2011 at 4:34 PM, Rishi Arora <rishi.ar...@ship-rack.com>wrote:

> I came across this (
> http://code.google.com/appengine/docs/python/taskqueue/overview-push.html#Push_Queues_and_Backends).
>  Which suggests that I should be able to use a specific backend instance.
>  Not only was the backend started (really, enabled), but it was up and
> running too, from serving up a request recently.  In fact, I'm enqueueing
> the taskqueue request from the backend itself (the backend logs prove it
> too).  I tried your method too (using just the backend name, and no instance
> prefix), and that didn't work either.  The only difference is that I'm not
> passing any "params" parameter in the taskqueue.add() call.  The request is
> just meant to be a trigger and does not carry any data.  Perhaps the app
> engine scheduler thinks that my backend is busy (cause it was processing the
> current request which enqueued the new taskqueue request), and that causes
> it to send the request to a front-end instance.  Maybe I should send the
> taskqueue rquest with a "countdown" set to a comfortable 10 seconds or
> something.
>
> Here's the snippet from the link above:
>
> Push tasks typically must finish execution within 10 minutes. If you have
> push tasks that require more time or computing resources to process, you can
> use App Engine Backends to process these tasks outside of the normal limits
> of App Engine applications. Backends are addressable. When you create the
> push task, all you need to do is address it to the URL of the backend you
> wish to process it. The following code sample demonstrates how to create a
> push task addressed to an instance 1 of a backend named backend1:
> from google.appengine.api import taskqueue
> ...
>     def post(self):
>         key = self.request.get('key')
>
>         # Add the task to the default queue.
>         taskqueue.add(url='/path/to/my/worker/', params={'key':
> key}, target='1.backend1')
>
>
>
> On Fri, Sep 9, 2011 at 4:10 PM, Steve Sherrie <st...@wasteofpaper.com>wrote:
>
>> **
>> I'm able to direct tasks to the backends using the *target* arg as in
>> your example. And the backend state is 'start' when you're trying this?
>>
>> Are you directing toward a specific backend instance (*N.backend_name*)
>> or just to *backend_name*? I am doing the latter.
>>
>>
>> Steve
>>
>>
>>
>> On 11-09-09 05:00 PM, Rishi Arora wrote:
>>
>> Thanks.  Yes that worked for me.  It just seems that backend documentation
>> isn't very intuitive.  I couldn't tell from any of the online docs that
>> simply adding a backend to backends.yaml won't configure a backend for you.
>>  It won't show up in the backends section of the admin console until you
>> execute appcfg.py update backends.
>>
>>  Another non-intuitive behavior - probably only for dynamic backends.
>>  The admin console has a start/stop button.  But obviously, if you hit
>> start, the dynamic backend won't actually start.  That's clear from the
>> documentation.  But, if you hit "stop", it almost looks like that the
>> backend is made inaccessbile.  It won't process requests, and it won't
>> automatically restart on the next request.  You have to hit the "start"
>> button first.  I think for dynamic backends that button should read
>> "enable/disable".
>>
>>  Now the next thing I'm trying to get to work is sending a backend a
>> request from a task queue.  I'm using the default task queue to do this, and
>> simply doing this doesn't work (a front-end instance processes the taskqueue
>> request):
>>
>>  taskqueue.add(url=[relative path to request handler], method='POST',
>> target=[backend name from app.yaml])
>>
>>  Modifying the above statement to specify the entire URL for the backend
>> in the "target" parameter does not help either - the taskqueue request is
>> still processed by a front-end instance.  I also tried just getting rid of
>> the "target" parameter, and specifying the entire url in the "url" parameter
>> i.e. url='https://backend.appid.appspot.com/path/to/requesthandler'.  And
>> even that did not help.  I fear forcing backends to process cron entries
>> defined with a full URL like above won't do the trick either.
>>
>>  So is there no way to force a backend to process a request?
>>
>>
>>
>> On Fri, Sep 9, 2011 at 3:45 PM, Steve Sherrie <st...@wasteofpaper.com>wrote:
>>
>>> Also, you can do...
>>> *
>>> *
>>>  *appcfg.py update **--backends your_app*
>>>  *
>>> *
>>>  *
>>> *
>>>  Steve
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Google App Engine" group.
>>>  To view this discussion on the web visit
>>> https://groups.google.com/d/msg/google-appengine/-/gvpp7TaOlykJ.
>>>
>>> To post to this group, send email to google-appengine@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> google-appengine+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-appengine?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To post to this group, send email to google-appengine@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine?hl=en.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To post to this group, send email to google-appengine@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine?hl=en.
>>
>
>

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

Reply via email to