I try to use AppEngine's modules api for python to obtain the number of instances for a module that uses basic scaling. In my module's yaml file I have explicitly set the max_instances parameter. I expect that get_num_instances() will return that parameter's value.
The problem: Whenever I fire modules.get_num_instances(...), the method raises an InvalidVersionError.
My app has only one version, "v1". The error is raised when I set the version parameter to "v1" or even leave it to None (which according to the documentation takes the current version).
The moment I am calling get_num_instances() there are no active instances in that particular module. Does this make a difference?
I haven't found a way to call this method without raising the error. The issue appears in both GAE and dev_server. I 'm working with SDK version 1.9.18.
Update Here's the yaml file for the module
application: my_gae_app
module: my_module
version: v1
runtime: python27
api_version: 1
threadsafe: true
instance_class: B2
basic_scaling:
max_instances: 3
idle_timeout: 1m
inbound_services:
- warmup
skip_files:
- ^(.*/)?#.*#
- ^(.*/)?.*~
- ^(.*/)?.*\.py[co]
- ^(.*/)?.*/RCS/.*
- ^(.*/)?\..*
- ^(.*/)?tests$
- ^(.*/)?test$
- ^Makefile
- ^COPYING.LESSER
- ^README.md
- \.gitignore
- ^\.git/.*
- \.*\.lint$
- ^\localdata/.*
builtins:
- appstats: on #/_ah/stats/
- remote_api: on #/_ah/remote_api/
- deferred: on
handlers:
- url: /.*
script: my_start_script.the_wsgi_app
libraries:
- name: jinja2
version: "2.6"
- name: webapp2
version: "2.5.2"
- name: markupsafe
version: "0.15"
- name: webob
version: "1.2.3"
- name: ssl
version: latest
I 've tried calling get_num_instances() as follows:
- get_num_instances(module='my_module', version='v1')
- get_num_instances(module='my_module')
- get_num_instances()
I also double checked the module name spelling, modules.get_modules() returns the name correctly. I did the same for version, modules.get_current_version_name() returns "v1".