Jeremy
Jeremy

Reputation: 1089

Starting app engine modules in Google App Engine

App engine "modules" are a new (and experimental, and confusingly-named) feature in App Engine: https://developers.google.com/appengine/docs/python/modules. Developers are being urged to convert use of the "backends" feature to use of this new feature.

There seem to be two ways to start an instance of a module: to send a HTTP request to it (i.e. at http://modulename.appname.appspot.com for the appname application and modulename module), or to call google.appengine.api.modules.start_module().

The Simple Way

The simple way to start an instance of a module would seem to be to create an HTTP request. However, in my case this results in only two outcomes, neither of which is what I want:

Starting via the API

The documentation says that calling start_module() with the name of a module and version should cause the specified version of the specified module to start up. However, I'm getting an UnexpectedStateError whenever I call this function with valid arguments.

The Unfortunate State of Affairs

Because I can't get this to work, I'm wondering if there is some subtlety that the documentation might not have mentioned. My setup is pretty straightforward, so I'm wondering if this is a widespread problem to which someone has found a solution.

Upvotes: 2

Views: 1496

Answers (3)

Jeremy
Jeremy

Reputation: 1089

It turns out that versions cannot be numeric. This problem seems to have been happening because our module's version was "1" and not (for example) "v1".

Upvotes: 3

dragonx
dragonx

Reputation: 15143

You can add:

login: admin

To the handler for your backend. This way an admin user can call your backend and trigger it to run. With login: admin, you can also have issue URLFetch requests froom elsewhwere in your app (ie from a frontend) trigger your backend.

Upvotes: 0

dragonx
dragonx

Reputation: 15143

With modules, they changed the terminology around a little bit. What used to be "backends" are now "basic scaling" or "manual scaling" instances.

"Automatic scaling" and "basic scaling" instances start when they process a request, while "manual scaling" instances run constantly.

Generally to start an instance you would send an HTTP request to your module's URL.

start_module() seems to have limited use for modules with "manual scaling" instances, or restarting modules that have been stopped with stop_module().

Upvotes: 0

Related Questions