Low Overhead CapabilityDisabledError Check

8 views
Skip to first unread message

Greg

unread,
Jun 8, 2009, 1:58:06 AM6/8/09
to Google App Engine
With the upcoming maintenance, I want to add a check at the start of
the handler to see if I should display a maintenance notice. This will
run on every request, so it would be good to use as lightweight a
check as possible. The documentation says CapabilityDisabledError is
thrown by db.Model.put(), db.Model.delete(), and
db.run_in_transaction().

My question is this: can I use run_in_transaction() with a dummy
function - testing without the overhead of actually doing a put()?

I realise that in this case memcache is also being disabled, so I can
test by doing a memcache.set() instead, but it would be nice to
develop a function that can be called to test both, for cases when
maintenance only affects one or the other. Also could a Googler
comment on how syncronised the disabling of datastore and memcache
are? Milliseconds, seconds, or minutes?

Ian Lewis

unread,
Jun 8, 2009, 2:18:17 AM6/8/09
to google-a...@googlegroups.com
Greg,

Please star this issue.
http://code.google.com/p/googleappengine/issues/detail?id=1116

One person noted in the comments that you could cache a system wide value when the first put request fails so that you don't have to do a test put() on every request to your application.

It would be interesting if run_in_transaction throws this exception even with dummy functions but I would guess that it doesn't throw the error unless it actually tries to a write.

Ian
--
=======================================
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianm...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
=======================================

Nick Johnson (Google)

unread,
Jun 10, 2009, 8:14:42 AM6/10/09
to google-a...@googlegroups.com
Hi Greg,

You might want to check out the Capabilities API: http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/api/capabilities/__init__.py

It will let you determine if a particular service is expected to be unavailable.

-Nick Johnson
Reply all
Reply to author
Forward
0 new messages