GAE Task Queue no longer passes payload to web2py function

45 views
Skip to first unread message

Carl Hunter Roach

unread,
May 24, 2019, 6:43:26 AM5/24/19
to web2py-users
This code has been working for a couple of years but, for an unknown reason to me, has stopped working.

This function continues to create Tasks correctly.

    def send_task():
            from google.appengine.api import taskqueue
            json_data = ...
            task = taskqueue.Task(url=..., countdown=2, payload=json_data)
            task.add()

The handling url is passed to:

    in db.py
    openings_service = Service()


    in controller...
    @openings_service.json
    def opening_task_queue():
        body_data = request.body.getvalue()

For the last couple of years `body_data` was populated and processing continued.
But last week, without change to my code, request.body was no longer present.

I had been running with Web2py R-2.14.6 but an upgrade to R-2.15.0b2 broke how I needed to declare functions.

Where I had been using function headings with no parameters:

    @openings_service.json
    def submit_openings():

I now needed to declare:

    @openings_service.json
    def submit_openings(openings):

Does anyone know why?
And does that relate to the error I detail at the top of this post?

Dave S

unread,
May 24, 2019, 4:37:53 PM5/24/19
to web2py-users


On Friday, May 24, 2019 at 3:43:26 AM UTC-7, Carl Hunter Roach wrote:
This code has been working for a couple of years but, for an unknown reason to me, has stopped working.

This function continues to create Tasks correctly.

    def send_task():
            from google.appengine.api import taskqueue
            json_data = ...
            task = taskqueue.Task(url=..., countdown=2, payload=json_data)
            task.add()

The handling url is passed to:

    in db.py
    openings_service = Service()


    in controller...
    @openings_service.json
    def opening_task_queue():
        body_data = request.body.getvalue()

For the last couple of years `body_data` was populated and processing continued.
But last week, without change to my code, request.body was no longer present.

I had been running with Web2py R-2.14.6 but an upgrade to R-2.15.0b2 broke how I needed to declare functions.


Ooooh, yuck.  2.15.0b2 is not a good choice; I'm using 2.15.4, and the 2.18.x line is much, much better (pending upgrade, but I've been letting other people shake the low-hanging fruit off first)

 

Where I had been using function headings with no parameters:

    @openings_service.json
    def submit_openings():

I now needed to declare:

    @openings_service.json
    def submit_openings(openings):

Does anyone know why?
And does that relate to the error I detail at the top of this post?


That change should not be the case.   Functions as URL targets should not have parameters, and none of my @auth_requires_login() or @request.restful() uses have had to add parameters after the annotation.

/dps

Carl Hunter Roach

unread,
May 24, 2019, 5:41:02 PM5/24/19
to web2py-users
Thanks for responding dps.

Having found the issue arrive with the R-2.15.0b2 release I did try the latest 2.18x line. But that too was broken so I went back to R-2.14.6
But then last week the issue started to occur (I hadn’t pushed any code so this change is hard to explain, to say the least).

It’s good to hear you don’t have this issue with R-2.15.4. I’ll try that and see if it bears fruit.

Carl Hunter Roach

unread,
May 28, 2019, 7:11:40 AM5/28/19
to web2py-users
I installed R-2.15.4.
You are right that I don't get any function parameters in the functions that handle my Google tasks.

I am getting a weird error.

In the function handling the Google task that historically worked) the value of `request.body` is:
<open file '<fdopen>', mode 'w+b' at 0x2b31c3ed9930>

That is weird. For the payload of the Google task I'm passing in some json data.

I can't see where an fdopen value would be coming from.

Dave S

unread,
May 28, 2019, 2:09:55 PM5/28/19
to web2py-users


On Tuesday, May 28, 2019 at 4:11:40 AM UTC-7, Carl Hunter Roach wrote:
I installed R-2.15.4.
You are right that I don't get any function parameters in the functions that handle my Google tasks.

I am getting a weird error.

In the function handling the Google task that historically worked) the value of `request.body` is:
<open file '<fdopen>', mode 'w+b' at 0x2b31c3ed9930>

That is weird. For the payload of the Google task I'm passing in some json data.

I can't see where an fdopen value would be coming from.


I'm afraid you've gone beyond my experience.  I haven't used GAE.  I know Massimo and some others of the core group have, but you may need to check that there isn't something in your YAML that GAE has obsoleted or has always considered wrong but tolerated until now.  I know that GG code is tweaked fairly often, and given Google's continuous integration strategy, I'd expect GAE to be updated frequently as well.

/dps

Carl Hunter Roach

unread,
May 28, 2019, 2:29:24 PM5/28/19
to web...@googlegroups.com
Thanks Dave. I’m thinking it must be something of that order too. Time to rebuild this project’s yank file.

Carl Hunter Roach
Bisham Barn Owl Group
Middle Thames Conservation Trust
Runnymede Ringing Group

Founder, Midnight 30 Ltd
Makers of Great Careers
 

From: web...@googlegroups.com on behalf of Dave S <snide...@gmail.com>
Sent: Tuesday, May 28, 2019 7:10 pm
To: web2py-users
Subject: [web2py] Re: GAE Task Queue no longer passes payload to web2py function
 
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/tAd7MgqZ9so/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/22ae6bd1-dbf8-4bfa-bd01-b2448577e509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages