getting InvalidModuleError when trying to add job to taskqueue

353 views
Skip to first unread message

Dewey Gaedcke

unread,
Mar 28, 2017, 8:35:44 PM3/28/17
to Google App Engine
My code has not changed but I upgraded GCloud earlier today and now I'm getting this crazy "InvalidModuleError".

my imports look like this:
from google.appengine.api import taskqueue
but on the web I see examples like this:
from google.appengine.api.taskqueue import taskqueue

but that does not fix it either and would make me uncertain about deploying even if it worked...

Has something changed??
Can someone please tell me what's going on?

  File "/Users/dgaedcke/dev/TouchstoneMicroservices/common/async_tasks/push_notify.py", line 49, in registerPush


    taskqueue.add(target='task', queue_name=GAEQ_FOR_PUSH_NOTIFY, url=url, params=params )


  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/api/taskqueue/taskqueue.py", line 2505, in add


    return Task(*args, **kwargs).add(


  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/api/taskqueue/taskqueue.py", line 823, in __init__


    self.__resolve_hostname_and_target()


  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/api/taskqueue/taskqueue.py", line 877, in __resolve_hostname_and_target


    host = self.__host_from_target(self.__target)


  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/api/taskqueue/taskqueue.py", line 957, in __host_from_target


    instance=instance)


  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/api/modules/modules.py", line 459, in get_hostname


    _ResultHook).get_result()


  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 613, in get_result


    return self.__get_result_hook(self)


  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/api/modules/modules.py", line 442, in _ResultHook


    _CheckAsyncResult(rpc, mapped_errors, [])


  File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/google/appengine/api/modules/modules.py", line 147, in _CheckAsyncResult


    raise mapped_error()


InvalidModuleError



Dewey Gaedcke

unread,
Mar 29, 2017, 1:07:42 PM3/29/17
to Google App Engine

OK....I found the problem. The dev server was starting up without the taskqueue server running and so I guess the whole taskqueue package was not added to the google.api package....

Seems like a better error would be useful in that case....

Nick (Cloud Platform Support)

unread,
Mar 29, 2017, 2:54:57 PM3/29/17
to google-a...@googlegroups.com
Hey Dewey,

A thread like this, asking for technical support without determining whether it's the responsibility of your code or an issue with the platform / SDK itself, should be made to Stack Overflow. An issue which you've determined to be in our code / within our responsibility to fix, should be posted to the Public Issue Tracker. We monitor these forums as well. This forum is not meant for technical support or issue reporting, but is meant for general and high level discussion of the platform and services, less specific and goal directed threads to which many users can contribute. 

I'd like to create a Feature Request in the Public Issue Tracker from your post here to show an example of how to file a feature request for more clear errors once we've determined that an error needs a more clear message. The issue is, I'm not quite sure what was going wrong or what you did to fix it. Could you clarify what you saw, what you expected to see, what you saw instead, and what you did to change the issue?

Cheers,

Nick
Cloud Platform Community Support

Dewey Gaedcke

unread,
Mar 30, 2017, 12:29:13 AM3/30/17
to Google App Engine
Hi Nick...thanks for your reply.

I did also post this to SO but have received no responses....seems no one else has seen this
And since my code did not change, but I had recently upgraded the SDK, I was unclear what was causing the problem.  But here is the summary:

the backend for our mobile app (under app.yaml) calls these two lines:
from google.appengine.api import taskqueue
taskqueue.add(target='task', queue_name=GAEQ_FOR_PUSH_NOTIFY, url=url,params=params )

That taskqueue.add() caused the error & resulting stack-trace shown above.

I had been starting my local dev-server via CLI like this:

dev_appserver.py --clear_datastore 0 app.yaml service_admin.yaml --logs_path=/tmp/gaelogs --log_level=debug


I didn't realize that I had grabbed an old example from our dev-onboarding document...and I should have been starting the local server like this:


dev_appserver.py --clear_datastore 0 app.yaml service_admin.yaml service_task.yaml --logs_path=/tmp/gaelogs --log_level=debug


once I also started the task microservice, the crash disappeared....or at least I've not seen it again


service_task.yaml is the one that includes:

- url: /_ah/queue/deferred
script: google.appengine.ext.deferred.handler
login: admin

in the handlers section


all I can guess is that this caused the local environment to start up the task queue....but I really am only guessing...

Nick (Cloud Platform Support)

unread,
Mar 30, 2017, 6:02:25 PM3/30/17
to Google App Engine
Hey Dewey,

That's an interesting pattern I can't say I've seen before. Now that you provide more details I see what you meant in your original post. I've attempted to reproduce this issue but haven't been able to observe it occurring. If you want to file a Feature Request for a better error message in the Public Issue Tracker, be sure to include a reproducing example app (you can produce this by stripping everything from your app that's proprietary / not necessary for reproducing the issue). We monitor the Public Issue Tracker regularly and would be happy to take your report.

 
Cheers,

Nick
Cloud Platform Community Support

Reply all
Reply to author
Forward
0 new messages