Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App Engine Version, Memcache

I am developing an App Engine App that uses memcache. Since there is only a single memcache shared among all versions of your app I am potentially sending bad data from a new version to the production version memcache. To prevent this, I think I may append the app version to the memcache key string to allow various versions of the app to keep their data separate.

I could do this manually, but I'd like to pull in the version from the app.yaml

How can I access the app version from within the python code?

like image 384
Ryan Bavetta Avatar asked Oct 20 '10 10:10

Ryan Bavetta


1 Answers

The os.environ variable contains a key called CURRENT_VERSION_ID that you can use. It's value is composed of the version from app.yaml concatenated together with a period and what I suspect is the api_version. If I set version to 42 it gives me the value of 42.1. You should have no problems extracting the version number alone, but it might not be such a bad idea to keep the api_version aswell.

EDIT:

@Nick Johnson has pointed out that the number to the right of the period is the minor version, a number which is incremented each time you deploy your code. On the development server this number is always 1.

like image 72
Klaus Byskov Pedersen Avatar answered Oct 03 '22 14:10

Klaus Byskov Pedersen