Unable to set manual scaling on a google app engine service - python

I am unable to set manual scaling on a google app engine service (Previously called module). Using python on app engine.
app.yaml:
application: xxx-xxxx
version: 2
runtime: python27
module: xxbackend
instance_class: F4
api_version: 1
threadsafe: true
handlers:
- url: /taskcontroller\.py
script: TaskController.app
so on...
libraries:
- name: webapp2
version: latest
- name: numpy
version: "1.6.1"
- name: PIL
version: latest
inbound_services:
- warmup
xxbackend.yaml:
application: xxx-xxxx
version: uno
module: xxbackend
runtime: python27
api_version: 1
instance_class: B4
manual_scaling:
instances: 5
Even though I have specified instance class and manual scaling settings in xxbackend.yaml, the xxbackend instances are still autoscaled. Can someone point out where I am going wrong?

You have the same module: name is both yamls. app.yaml should not specify a module, so it uses the default module. So remove module: xxbackend from app.yaml. Otherwise, you are overriding the expected config.
Then, when you deploy, use a command like:
appcfg.py update app.yaml xxbackend.yaml
That deploys both updated yaml files.

Related

How to add a second module to GAE?

I have followed the docs to create an additional B2 module to my existing default F1 instance.
app.yaml (default instance)
application: myapp-uat
version: 1-7-0
runtime: python27
api_version: 1
instance_class: F1
automatic_scaling:
max_idle_instances: 2
max_pending_latency: 1s
threadsafe: true
- url: .*
script: run.myapp.app
and the new module:
application: myapp-uat
module: backend
version: 1.0.0
runtime: python27
api_version: 1
threadsafe: true
instance_class: B2
manual_scaling:
instances: 1
- url: /generator
script: run.myapp.app
login: admin
I have updated the app like this:
appcfg.py update src app.yaml backend.yaml
However looking at my modules in dashboard, I only see the default instance. Something isn't quite right here.
Ok I had done something quote silly. The correct way would be:
appcfg.py update src/app.yaml src/backend.yaml
and last but not least the dispatch needs to be called:
appcfg.py update_dispatch src

Django 1.5 on App Engine

I'm having some difficulties setting up Django 1.5 to run via the dev_appserver.py, rather than the manage.py runserver.
The project directory is as such:
env
myproject
manage.py
myproject
init, settings, urls, wsgi (.py)
I've tried to two following ways to get it working with the App Engines appserver:
app.yaml:
application: appname
version: 1
runtime: python27
api_version: 1
threadsafe: true
libraries:
- name: django
version: "1.5"
builtins:
- django_wsgi: on
as suggested from this tutorial https://cloud.google.com/appengine/docs/python/cloud-sql/django
It does not produce any error when setting the up the local server, but when I access the given link, I get this error:
RuntimeError: django must be included in the "libraries:" clause of your app.yaml file when using the django_wsgi builtin.
Next I've tried it in a slightly different way.
With app.yaml
application: myapp
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: .*
script: main.application
libraries:
- name: django
version: "1.5"
and a main.py as such:
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
which produces the following error:
File "C:\Users\Mello\AppEngine\02\myproject\main.py", line 4, in module>
import django.core.handlers.wsgi
ImportError: No module named django.core.handlers.wsgi
Even though if I run
>>>import django.core.handlers.wsgi
>>>
in the same virtual environment, it runs fine.
Anybody has any piece of advice to point me in the right direction to fix this?
Thanks

Migrating from Google App Engine Backends to Modules

Google has deprecated its Backends API and has been telling all users to migrate to the Modules API for GAE projects.
After updating my app.yaml and clicking the migrate button in the Application Settings>Performance page, my application is still giving me this error:
WARNING 2014-08-26 13:49:57,888 backends.py:55] The Backends API is deprecated and will be removed in a future release. Please migrate to the Modules API as soon as possible.
Why is GAE still identifying my application as using the Backends API?
My app.yaml file:
application: app-name
version: baseline
runtime: python27
api_version: 1
threadsafe: true
instance_class: F4
automatic_scaling:
max_idle_instances: 10
min_pending_latency: 10ms
max_pending_latency: 8s
builtins:
- deferred: on
- admin_redirect: on
- appstats: on
- remote_api: on
includes:
- config/index.master.yaml
libraries:
- name: jinja2
version: latest
- name: lxml
version: latest
- name: webob
version: latest
- name: numpy
version: latest
- name: webapp2
version: latest
- name: ssl
version: latest
- name: pycrypto
version: latest
skip_files:
- ^(.*/)?.*\.coffee
- ^(.*/)?.*\.scss
- ^(.*/)?app\.yaml
- ^(.*/)?app\.yml
- ^(.*/)?index\.yaml
- ^(.*/)?index\.yml
- ^(.*/)?#.*#
- ^(.*/)?.*~
- ^(.*/)?.*\.py[co]
- ^(.*/)?.*/RCS/.*
- ^(.*/)?\..*
- ^/docs*
Edit. My app is not importing the backends module directly, but appears to be importing it directly through the Admin Panel library. The error is triggered whenever the admin panel page is loaded, using this script handler:
- url: /googleadmin.*
script: google.appengine.ext.admin.application
login: admin
Could it be you still have a backend import somewhere in your code?
Looking at the warning, seems like you're still using "backends.py"
One interesting thing that happened in my team when we were working on different projects is that we received these deprecated calls on APIs we didn't EVEN use. Seems like internally some "new" APIs use the deprecated ones, which can cause these errors. I don't think it's risky or dangerous, but definitely not the behaviour one would expect.

Can't Use Pycrypto in Google App Engine Production

I am successfully using Pycrypto vs. 2.6 in my GAE development environment under Python 2.7. However, deploying it to Google production I see the following error in the logs:
from Crypto.Cipher import _AES ImportError: cannot import name _AES
My App.Yaml:
application: appname
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: .*
script: main.app
secure: always
libraries:
- name: webapp2
version: "2.5.2"
- name: pycrypto
version: "2.6"
The Python call in question:
from Crypto.Cipher import AES
Checking Google support documents and they do list Pycrypto 2.6 as supported. I also tried to enter "latest" for the version and received the same error. Again in development GAE on my local machine it works perfectly.
Issue resolved. I had a directory from my Windows installation called "Crypto" in my App Engine project directory. When the app loader loaded the files it also included this directory which conflicted with what Google has loaded in production. Removal of this directory from the local project directory resolved the problem upon the next push to Google.

MissingURLMapping: No URLMap entries found in application configuration

I'm new in GAE development, I've just created a simple API but I'm unable to run my app, because I keep getting the error No URLMap entries found in application configuration.
Here's my app.yaml file
application: gw2
version: 1
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /_ah/spi/.*
script: main.api_server
libraries:
- name: pycrypto
version: latest
- name: endpoints
version: 1.0
And here is my main.py file where I've declared the api_server variable
from google.appengine.ext import endpoints
import api
api_server = endpoints.api_server([api.GW2Service])
GW2Service inherits from remote.Service
Edit I'm using command line tools (Ubuntu 12.04)
Where's the mistake?
Thanks in advance. Eric ~H
You start server from the app or command line?
Try using "import endpoints" not from ... import endpoints
In app.yaml set endpoints version to latest.
Move GW2Service to main.py and test if server is ok. The problem might be generated by file name "api".

Categories

Resources